BUG: Named pipes do not work when worker process runs under ASPNET account (315159)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework)
  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft ADO.NET (included with the .NET Framework)
  • Microsoft ADO.NET (included with the .NET Framework 1.1)
  • Microsoft ADO.Net 2.0

This article was previously published under Q315159

SYMPTOMS

You may receive an error message if all the following conditions are true:
  • An ASP.NET worker process (Aspnet_wp.exe) runs under the default ASPNET account.
  • You do not enable impersonation on that application.
  • You use the SQL Server .NET Data Provider or the OLE DB .NET Data Provider to connect to a database.
You may receive any of the following error messages:
Message 1
OleDbException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.]
Message 2
SqlException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.]
Message 3
System.Data.SqlClient.SqlException: SQL Server does not exist or access denied
Message 4
System.Data.OleDbClient.OleDbException: SQL Server does not exist or access denied

CAUSE

When the ASP.NET worker process runs under the ASPNET account, if you do not enable impersonation for an application, all the threads that run the requests for that application run under the process account. The ASPNET account cannot establish a named pipes connection to the database server.

RESOLUTION

To work around this problem, use one of the following methods:
  • Turn on impersonation on your ASP.NET application. This method works if the impersonated user has access to the computer and to the database server that you access.
  • Use Transmission Control Protocol/Internet Protocol (TCP/IP) instead of the named pipes protocol to connect to the database. To do this, add the following attribute to the connection string:
    "Network Library =dbmssocn"
    						
    For example:
    "User ID=myUserId;Password=myPassword;Initial Catalog=Pubs;Data Source=myServer;Network Library =dbmssocn"
    					
  • Check the database for the protocols that are enabled. For a SQL Server database, run the Server Network Utility to check for specific protocols.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

REFERENCES

For additional information about ASP.NET security, click the following article number to view the article in the Microsoft Knowledge Base:

306590 ASP.NET security overview

For more information about the <processModel> section, refer to the following MSDN documentation:

Modification Type:MajorLast Reviewed:3/13/2006
Keywords:kbbug kbDatabase kbHttpRuntime kbnofix kbreadme kbSecurity KB315159 kbAudDeveloper