Solved

Problem with SQL now site is published

Posted on 2006-11-24
8
225 Views
Last Modified: 2010-04-06
Hi all,

I have had similar problems with his before when uploading a site with a database.  I have a single page site that has a SQL connection to a SQL 2000 database.  Nothing complicated at all.  The site works fine locally on my machine when I run it, but when published to either my local IIS 5 server or my companies II6 server I get the following message when opening the page.

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

This is my connection string from within the web.config file:
<add name="CReqDBConnectionString" connectionString="Data Source=EQ-WEB01;Initial Catalog=CReqDB;Integrated Security=True"

And this is it within the SQLDataSource Control on the page:
Data Source=EQ-WEB01;Initial Catalog=CReqDB;Integrated Security=True

Thanks for all your help
0
Comment
Question by:2326ac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
8 Comments
 
LVL 29

Expert Comment

by:Nightman
ID: 18006343
You need to use impersonation in the web.config file. Have a look at http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/ASP_DOT_NET/Q_22070218.html
0
 

Author Comment

by:2326ac
ID: 18006391
Thanks for the quick reply, so is it just as case of pasting

<system.web>
<identity impersonate="true" userName="WindowsDomain\YourUserName" password="YourPassword" />
</system.web>

into my config file?  Adding my user name and password of course
0
 
LVL 29

Accepted Solution

by:
Nightman earned 250 total points
ID: 18006424
Only if you want to impersonate with a specific user.
If you want to use normal Windows Authentication (i.e. the user that is connecting to the web sites credentials) then you just do:

<system.web>
<identity impersonate="true"/>
</system.web>
0
 
LVL 11

Assisted Solution

by:AlexanderR
AlexanderR earned 250 total points
ID: 18012489
Just a thoughed...

When i tried to run an application that uses a MySQL database not on the same computer that MySQL is running, i had to explicitly allow YourUserName to connect from a particular computer. In another words MySQL does not allow just any computer to connect to it but only those that are allowed in the administration.

Can your SQL2000 possibly be the same way, not allowing computer that you publish your stuff on to connect to itself??
0
 
LVL 29

Expert Comment

by:Nightman
ID: 18012502
Yes. Either you need to connect with a specific MSSQL user in the connection string (and this would obviously have to have been created on the SQL Server) OR with Windows Authentication.

Using Windows Authentication, the windows account used is by default 'NT AUTHORITY\NETWORK SERVICE'. You can't grant this user access on another server (as it is local to the web server) BUT you can use impersonation. Using impersonate = true (without a specific account) will force the web server to connect to the database server using the windows account of the user connecting to the web site. This obviously is only useful when you can be sure that all users have an account on the domain.

Using a specific account in the web.config means that the users will all connect to SQL Server (and in fact any other network resources) as the specified user, and not the user loggin in or the Network Service.

And best practice is to have the database server on a different machine to the web server (obviously if budget allows)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question