Microsoft KB Archive/315159

From BetaArchive Wiki
Knowledge Base


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

Article ID: 315159

Article Last Modified on 5/13/2007



APPLIES TO

  • Microsoft .NET Framework 1.1 Service Pack 1
  • Microsoft ASP.NET 1.1
  • Microsoft .NET Framework 1.1 Service Pack 1
  • Microsoft ADO.NET 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:


Additional query words: kbreadme

Keywords: kbbug kbnofix kbhttpruntime kbdatabase kbsecurity kbreadme KB315159