我已经构建了一个.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