我有一个SQL Azure实例设置,并可以连接到它没有来自SQL Server Management Studio的问题。然而,当我的应用程序试图连接,出现此错误:无法连接到SQL Azure从应用程序,但可以从SSMS
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)
我使用实体框架代码第一次4.1和ASP.NET MVC 3,我的应用程序成功地利用了SQL Express最初被开发。现在我正在使用this tutorial to move the database to SQL Azure(应用程序最终会移动到那里,但开发仍在继续)。
由于SSMS工作正常,我猜它归结为web.config?我试着连接字符串名称的每个组合:
<connectionStrings>
<add name="ApplicationServices" connectionString="Server=tcp:suppressed.database.windows.net,1433;Database=EventsTest;User ID=suppressed;Password=suppressed;Trusted_Connection=False;Encrypt=True;PersistSecurityInfo=True;" providerName="System.Data.SqlClient" />
<add name="DomainContext" connectionString="Server=tcp:suppressed.database.windows.net,1433;Database=EventsTest;User ID=suppressed;Password=suppressed;Trusted_Connection=False;Encrypt=True;PersistSecurityInfo=True;" providerName="System.Data.SqlClient" />
<add name="Events.DataAccess.EntityFramework.DomainContext" connectionString="Server=tcp:suppressed.database.windows.net,1433;Database=EventsTest;User ID=suppressed;Password=suppressed;Trusted_Connection=False;Encrypt=True;PersistSecurityInfo=True;" providerName="System.Data.SqlClient" />
</connectionStrings>
我还试图Wireshark的,我不是很了解,但似乎暗示了一些活动(192.168.1.101是我的机器,207.46.63.13是SQL Azure服务器):
1 0.000000 192.168.1.101 207.46.63.13 TCP [TCP segment of a reassembled PDU] 2 0.116269 207.46.63.13 192.168.1.101 TCP ms-sql-s > bmc-net-adm [ACK] Seq=1 Ack=2 Win=8444 Len=0 3 2.091928 192.168.1.101 207.46.63.13 TCP [TCP segment of a reassembled PDU] 4 2.209371 207.46.63.13 192.168.1.101 TCP ms-sql-s > kmscontrol [ACK] Seq=1 Ack=2 Win=5969 Len=0 5 2.352974 192.168.1.101 207.46.63.13 TCP [TCP segment of a reassembled PDU] 6 2.469444 207.46.63.13 192.168.1.101 TCP ms-sql-s > vaultbase [ACK] Seq=1 Ack=2 Win=8625 Len=0
任何想法可能发生了什么?
这正是我造成麻烦的原因。谢谢。 – Kenci 2014-12-01 20:35:13