日期:2012-06-26  浏览次数:20405 次

MS已经确认这是一个BUG了

BUG: Named Pipes Do Not Work When Worker Process Runs Under ASPNET Account
The information in this article applies to:
Microsoft ASP.NET (included with the .NET Framework)
Microsoft ADO.NET (included with the .NET Framework)

This article was previously published under Q315159
SYMPTOMS
Under the following circumstances
An ASP.NET worker process (Aspnet_wp.exe) runs under the default ASPNET account. -and-


You do not enable impersonation on that application. -and-


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:

OleDbException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.]
-or-



SqlException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.]
-or-



System.Data.SqlClient.SqlException: SQL Server does not exist or access denied
-or-



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:
Configure the ASP.NET worker process to run under the SYSTEM account in the <processModel> section of the Machine.config file.
Enable impersonation on your ASP.NET application. This method works if the impersonated user has access to the computer and the database server that you are accessing.
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"
                    
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
REFERENCES
For additional information about ASP.NET security, click the article number below to view the article in the Microsoft Knowledge Base:
306590 INFO: ASP.NET Security Overview

For more information about the <processModel> section, refer to the following MSDN documentation:
<processModel> Section
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfprocessmodelsection.asp

Last Reviewed: 6/14/2002
Keywords: kbbug kbDatabase kbDSupport kbHttpRuntime kbreadme kbSecurity KB315159