2016-08-28 64 views
0

在撰寫本文時使用Windows 10 Pro和VS2015 Pro進行所有更新。冉VS在安全模式和維修安裝Visual Studio沒有運氣。請注意,SSMS和其他應用程序可以隨時訪問數據庫。爲什麼重新啓動PC後重建會導致網絡錯誤?

該代碼可以簡化爲打開SQL數據庫連接;

Dim sqlCon As New SqlConnection("Server=server\instance;Database=database;User Id=…;Password=…") 
sqlCon.Open() 
'Works after reboot as many times as required but fails after build or rebuild! 
Console.WriteLine(「Connection Opened」) 
sqlCon.Close() 
sqlCon.Dispose() 

重建後的錯誤是;

Unhandled Exception: System.Data.SqlClient.SqlException: 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) 
+0

我想這是一個網絡相關的問題。 SQL Server服務設置爲「自動」啓動?也許它設置爲「延遲開始」? –

回答

0

原來我們的IT團隊已經在PC上安裝了Bitdefender端點安全工具。幸運的是,可以直接將合適的防火牆配置文件添加到內部的Bitdefender管理服務器。

相關問題