SQL Connection problem

  • Thread starter Thread starter Arda
  • Start date Start date
A

Arda

Hi all,
I tried to connect a database(SQL) by both VS 2003 interface tools and
normal typing.

When I make the connection in subdirectory project it doesn't work and gives
an
error like this;

Server Error in '/WebApplication1' Application.
----------------------------------------------------
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Nevertheless, when I use the same .aspx page in normal web site (without any
sub directory) it works without any error.

I have been using Windows 2000 and it was both working but when I installed
Windows 2003 Enterprise Edition, it started to give that error(below). So,
most probably this error acquires because of Windows 2003 settings is there
anyone who knows how to solve this problem?

Kind Regards,
Arda Coskun
 
Arda,
By default, the ASP.NET worker process on a Windows Server 2003 (IIS6)
machine uses the local "NT AUTHORITY\NETWORK SERVICE" user
account. And on Windows 2000 / XP (IIS 5.x), it uses the local ASPNET .
user account. Also, ASP.NET has impersonnation turned off by default.

Hence, in this configuration, if you want your web page to access a Sql Server
database, you'll need to give database access permissions to the corresponding
local user account, depending on which IIS version you are using.

Here is a summary for a machine called "CARLP7" on IIS 5.x,
with Authentication mode="Windows" in web.config

- If Identity impersonate="false" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\ASPNET

- If Identity impersonate="false" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\ASPNET

- If Identity impersonate="true" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\IUSR_CARLP7

- If Identity impersonate="true" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\Administrator (logged on user)


Here is a summary for a machine called "CARLP7" on IIS 6.0,
with Authentication mode="Windows" in web.config

- If Identity impersonate="false" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = NT AUTHORITY\NETWORK SERVICE

- If Identity impersonate="false" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = NT AUTHORITY\NETWORK SERVICE

- If Identity impersonate="true" and IIS Anon Access enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\IUSR_CARLP7

- If Identity impersonate="true" and IIS NTLM enabled
=> WindowsIdentity.GetCurrent().Name = CARLP7\Administrator (logged on user)

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 
Back
Top