我已經構建了一個.asmx Web服務,它從本地sql server 2014數據庫中檢索信息。 一切工作在本地主機上正常,但將Web服務發佈到Azure中後,我得到的錯誤:Web服務 - SQL連接字符串
An unhandled exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll
Additional information: Server was unable to process request. ---> 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)
SQL Server配置爲允許遠程連接。
我的連接字符串是這樣的:
string con2 = @"Data Source=OfficePc\MSSQLSERVER2014;Initial Catalog=Database;Persist Security Info=True;User ID=Admin;Password=123456";
是錯誤的東西從連接字符串中缺少的結果,還是我失去了一些配置的變化?
您確定這是正確的連接字符串嗎?例如,如果您使用Visual Studio,則可以在「服務器資源管理器」窗口上進行檢查。 – 2015-02-11 11:42:00
基於Azure的Web服務知道'OfficePc \ MSSQLSERVER2014'在哪裏?這不應該是一個IP或什麼? – 2015-02-11 11:44:51