我有一個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