Problem with SQL Server 2005 and IIS 6.0  
Author Message
inti





PostPosted: .NET Framework Data Access and Storage, Problem with SQL Server 2005 and IIS 6.0 Top

Hello,

I am having problems with my system configuration. I am trying to access a SQL Server 2005 database from a C# .NET web page, but I keep getting this error, "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'". I am using windows authentication. The SQL Server resides on one server and my web server is on a different server. If I run the both the web server and SQL Database from within the same server it works fine, the problem comes when I separate the servers.

I am running Windows Server 2003 on both servers, MS SQL Server 2005, MS Visual Studios 2005, and IIS 6.0.

Here is my Web.Config file:

< xml version="1.0" >

<configuration xmlns=" http://www.hide-link.com/ ">

<connectionStrings>

<add name="MyConnectionString" connectionString="Data Source=MYSERVER;Initial Catalog=mydatabase;Integrated Security=SSPI"

providerName="System.Data.SqlClient"/>

</connectionStrings>

<system.web>

<customErrors mode="Off"/>

<compilation debug="true">

<assemblies>

<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

</assemblies>

</compilation>

<identity impersonate="true"/>

<authentication mode ="Windows"/>

<authorization>

<deny users=" "/>

</authorization>

</system.web>

</configuration>

Any comments or suggestions would be greatly appreciated.

Thank you,

Inti




.NET Development23  
 
 
Paul Domag





PostPosted: .NET Framework Data Access and Storage, Problem with SQL Server 2005 and IIS 6.0 Top

Hi,

It's either the account that you are using in the webserver isn't valid to access sql server in the other computer. So I would suggest on creating a user in the SqlServer and changing your conneciton string to this:

"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=myUsername;Password=myPassword;"

cheers,

Paul June A. Domag



 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, Problem with SQL Server 2005 and IIS 6.0 Top


The below link should help. You're being tripped up by the the double-hop issue and the delegation of credentials to SQL Server is failing.

How to configure an ASP.NET application for a delegation scenario



 
 
inti





PostPosted: .NET Framework Data Access and Storage, Problem with SQL Server 2005 and IIS 6.0 Top

Thanks Paul,

I read a similar article about delegation, but I was wondering if there is a way to achieve without the installation of Active X.

Thanks again, Inti.



 
 
Paul P Clement IV





PostPosted: .NET Framework Data Access and Storage, Problem with SQL Server 2005 and IIS 6.0 Top


I'm not sure what you mean by Active X. Do you mean Active Directory

For trusted/Windows integrated security across computers you need to enable Kerberos. Otherwise, you need to use a different authentication method (such as Basic) for your web application when using trusted security with SQL Server. The only other option (using integrated security) would be to run your SQL Server on the same machine as the web server.