我检查了实例名称,自动关闭设置为true,允许在服务器上进行远程连接检查。当我打开SQL Server配置管理器时,服务器正在运行。我甚至重新启动。我已经创建了这个数据库,就像所有其他人一样。我使用实体框架并检查了web.config
中的名称,并且它们匹配。这是向导的默认连接字符串 - 我在部署之前用于测试。我只是想不出别的什么来检查,以弄清楚为什么它不会连接。在SQL Server内部工作一切都很好。尝试连接到SQL Server时出错 - localhost
以下是一般错误。
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: Shared >Memory Provider, error: 40 - Could not open a connection to SQL Server)
配置:
connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string='data source=.\SQL_1;attachdbfilename="C:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.SQL_1\MSSQL\DATA\A_db.mdf";integrated security=True;connect timeout=10;user instance=True;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />
在此先感谢。
你能显示使用的连接字符串吗? – Steve
请记住,此连接字符串是为本地主机自行生成的,服务器符合标准。由于奇怪的错误,我搬到了服务器。 – OneFineDay