我檢查了實例名稱,自動關閉設置爲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