我有一個Azure Web角色在過去幾天中出現了問題。在不改變任何東西或重新部署角色或數據庫的情況下,Web角色失去了連接到其數據庫的能力。它會拋出以下異常:在長時間運行的Azure Web角色上出現異常「目標主體名稱不正確」
System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The target principal name is incorrect.)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
...
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
...
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
重新啓動Web角色或角色的虛擬機無效。通過Web Deploy重新發布Web角色,即使不進行更改,也會暫時停止問題發生,有時甚至一天。
我打算重新部署整個軟件包以查看是否有幫助。
我能看到的唯一問題可能是問題是我們使用SQL數據庫服務器的DNS別名。我們使用「our.fqdn.com」代替連接字符串的「abcd4567.database.windows.net」。
雖然如此,Web角色仍然能夠完美地執行各種數據庫連接......直到它停止。
我們也沒有碰到油門,因爲有問題的數據庫沒有被大量使用,也許每小時有幾十個連接。
任何診斷思路都會有所幫助。
這個問題似乎已經解決了自身。所以亞當可能是正確的(重複的DNS條目),但它是他們修復的微軟狡猾的DNS。 –