Solved

Problem with SQL now site is published

Posted on 2006-11-24
8
224 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
Hide or Show Images using checkbox array in mysql database 11 290
css border raidius issue 7 93
Problem to ToolkitScriptManager 2 75
Unexpected End of File 11 54
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

740 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