SQL Server 命名管道提供程序错误但仅适用于 ASP.NET?
我有一个 SQL Server 实例抛出“命名管道提供程序”错误,代码为 40。我知道这是新安装中相对常见的错误,并且修复它的过程很复杂。然而,这个错误对我来说奇怪的部分是(1)它只是间歇性地发生,(2)它只发生在我的 ASP.NET 应用程序中。我有其他应用程序可以正常访问该服务器,没有任何错误。
当您的连接字符串是 ASPX 代码(而不是 web.config)的一部分时,我遇到了对发生此错误的模糊引用,这没有意义,但这是我能想到的唯一选项。还有其他人看过这个吗?
I have a SQL Server instance that is throwing the "Named Pipes Provider" error, code 40. I know that this is a relatively common error on new installs and there's a convoluted process to fix it. However, the odd part of this error for me is that (1) it only happens intermittently and (2) it only happens with my ASP.NET application. I have other apps that are accessing this server just fine without any errors.
I came across a vague reference to this error happening when your connection string is part of the ASPX code (as opposed to the web.config) and that doesn't make sense but it's the only option I could come up with. Anyone else seen this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来像是安全上下文问题? asp.net应用程序如何访问sql服务器?集成 Windows 安全性还是 sql 安全性?如果之前检查由应用程序池标识定义的应用程序(asp.net进程)的标识是否具有数据库的登录权限。
来自 http://blogs.msdn.com/b/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open- a-connection-to-sql-server.aspx :
摘要,给出清单:
您的目标服务器启动了吗?
你的目标服务器正在监听 NP 吗?哪个管道?
您的客户端启用了 NP 吗?使用与服务器相同的管道连接?
您正在建立本地连接吗?如果是这样,实例是什么,默认实例还是远程实例?
您在连接字符串中输入了正确的实例名称吗?请记住,Sqlexpress 是一个命名实例。
您是否启用了远程连接?防火墙? IPSec? “文件和打印机共享”打开了吗?可以访问服务器吗?
您可以使用 or \ 进行基本连接吗?使用sqlcmd或osql。
Sounds like a security context issue? How is the asp.net application accessing the sql server? Integrated windows security or sql security? If the earlier check that the identity of the application (asp.net process) which is defined by the Application Pool identity has login rights on the DB.
From http://blogs.msdn.com/b/sql_protocols/archive/2007/03/31/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx :
Summary, give checklist:
Is your target server started?
Is your target server listening on NP? Which Pipe?
Has your client enabled NP? Use the same pipe to connect as Server?
Are you making local connection? If so, what is the instance, default or remote?
Did you put correct instance name in the connection string? Remember, Sqlexpress is a named instance.
Did you enable remote connection? Firewall? IPSec? "File and Printer Sharing" opened? Can access server?
Can you make basic connection by using or \? Use sqlcmd or osql.