关于在连接数据库时候命名管道不工作的官方解决办法
2024-07-21 02:22:29
供稿:网友
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
,欢迎访问网页设计爱好者web开发。