【发布时间】:2011-01-20 08:00:48
【问题描述】:
可能重复:
A network-related or instance-specific error occurred while establishing a connection to SQL Server.
今天我创建了两个页面 login.aspx 使用 LOgin 控件和 register.aspx 使用创建用户向导 ...
当我在本地计算机中使用生产服务器的连接字符串时,只有当我的数据库 ASPNETDB.MDF 存在于本地计算机的 APP_Data 文件夹中时,站点才能工作..
如果我从本地计算机 App_Data 重命名 ASPNETDB.MDF 或删除 ASPNETDB.MDF,则会出现以下错误...
An attempt to attach an auto-named database for file C:\Users\Ashish Dobriyal\Documents\Visual Studio 2008\WebSites\VOLVOO\App_Data\ASPNETDB.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
但是
在我将我的网页.....和数据库发布到我的生产服务器之后......它会产生一个错误......
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
究竟是什么问题……??
我的生产服务器连接字符串:
<connectionStrings>
<remove name="ConnectionString"/>
<add name="ConnectionString" connectionString="workstation id=volvobusesindia.mssql.somee.com;packet size=4096;user id=username;pwd=password;data source=dobriyal.mssql.somee.com;persist security info=False;initial catalog=dobriyal" providerName="System.Data.SqlClient"/>
</connectionStrings>
我的本地服务器连接字符串:
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
【问题讨论】:
-
请发布您的连接字符串!两者:生产和开发
-
你一遍又一遍地问基本相同的问题 - 请停止!
-
我的问题无法解决...
-
可以解决的。但是一遍又一遍地问这个问题只会让社区感到沮丧。问一次这个问题。如果您还没有找到解决方案,请在您的位置更新您的问题。我们不是你忠实的仆人。
标签: asp.net visual-studio-2008 sql-server-2005 aspnetdb