无法连接到 asp.net 数据库以获取成员身份
我就直奔主题吧。我前段时间使用过会员功能,一切正常,没有出现任何问题。由于某些原因,我不得不重新安装整个Windows,并且还重新安装了Visual Studio和SQL Server。现在我正在尝试连接到会员数据库:我有一个“创建用户向导”控件,并且正在尝试创建一个新帐户。就这么简单。但我收到以下错误:
建立与 SQL Server 的连接时发生网络相关或特定于实例的错误。找不到服务器或无法访问服务器。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。 (提供程序:命名管道提供程序,错误:40 - 无法打开到 SQL Server 的连接)
当我尝试登录帐户时也会显示此错误,尽管该帐户不存在!
我还尝试使用 regsql 工具和此脚本手动安装数据库: aspnet_regsql -S (local) -E -A 好吧
,我再次遇到相同的错误(错误 40)
关于版本,我想我正在使用SQL Server 2008 Express。执行此查询时得到以下输出: "SELECT @@version"
Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86) 2009 年 3 月 29 日 10:27:29 版权所有 (c) 1988-2008 Microsoft Corporation Windows NT 6.1 上的 Express 版本(内部版本 7600:) 我没有找到针对这种情况的任何答案。谁能帮助我吗?
I'll go straight to the issue. I was using the membership feature a while ago and I was ok and didn't have any problems. I had to reinstall the whole windows for some reasons, and also reinstalled the visual studio and sql server among with that. Now I'm trying to connect to the membership database: I have a Create User Wizard control and I'm trying to create a new account. That simple. but I get the following error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
This error is also displayed when I try to login to an account, although it doesn't exist!
I've also tried to install the databases manually using regsql tool and this script: aspnet_regsql -S (local) -E -A all
Well, I get the same error again (error 40)
About the version, I guess I'm using Sql Server 2008 Express. I got the following output when I executed this query: "SELECT @@version"
Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (Intel X86)
Mar 29 2009 10:27:29
Copyright (c) 1988-2008 Microsoft Corporation
Express Edition on Windows NT 6.1 (Build 7600: )
I didn't find any answer for this situation. Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有一个非常长的页面来记录此错误: http:// /blogs.msdn.com/b/sql_protocols/archive/2005/10/22/483684.aspx
但是,尝试这些在进行繁琐的工作之前,请先解决这些问题,因为这通常是由一些常见问题引起的:
Here's an incredibly long page on documenting this error: http://blogs.msdn.com/b/sql_protocols/archive/2005/10/22/483684.aspx
But, try these things first before drudging through that, as it's typically caused by a few common things:
自从您重新安装 SQL Server 以来,您的连接字符串很可能不再有效。启动 SSMS 并查看您的计算机上是否没有运行第二个 SQL 实例。如果这样做,可能会导致一些连接错误。
只是为了阅读错误和其他一些可能的解决方案,您可能需要查看 SQL SERVER – 修复: SQLAuthority.com 博客上的错误:(提供程序:命名管道提供程序,错误:40 – 无法打开与 SQL Server 的连接)。您也许能够对您的问题以及可能的解决方案有更多的了解。
祝你好运。我自己也经历过这种情况,真的很痛苦。希望这对一些人有帮助。
It's quite possible that your connection string is no longer valid since you reinstalled SQL server. Fire up SSMS and see if you don't have a second instance of SQL running on your machine. If you do, that could be causing some of your connection errors.
Just to read up on the error and some other possible solutions, you might want to take a look at SQL SERVER – FIX : ERROR : (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) on the SQLAuthority.com blog. You might be able to get some more ideas of what your problem is, and possible solutions.
Good luck. I've been there myself and it's a real pain. Hope this helps some.