2014-11-03 86 views
2

我有一個Windows服務在與SQL Server數據庫使用通信的域服務帳戶的上下文下運行。它每10分鐘運行一次,並且每次都與數據庫通信。Windows服務上的間歇性錯誤:底層提供程序在打開時失敗

我有多次運行數天,然後我發現服務停止,因爲和異常被拋出。

望着日誌我發現:

Message: The underlying provider failed on Open.

Stack Trace: at System.Data.Entity.Core.EntityClient.EntityConnection.Open() ...

與內部異常:

Message: 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)

Stack Trace: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) ...

我與管理SQL Server中的DBA檢查和服務器啓動並在運行發生錯誤並且日誌中沒有任何相關信息表明停機或網絡連接丟失。

Windows服務使用實體框架6.使用.NET 4.5內置它使用下面的連接字符串:

<add name="AmceContext" 
     connectionString="data source=ServerName\InstanceName;initial catalog=DbName;integrated security=SSPI;MultipleActiveResultSets=True;App=EntityFramework" 
     providerName="System.Data.SqlClient" /> 

我可以設置是否停止Windows服務自動重新啓動。但我想找到潛在的問題。我也想到Connection Resiliency,但這可能會導致問題,因爲如果服務器名稱不正確,安裝服務時也可能發生此錯誤。換句話說,它可以不斷重試一個錯誤的連接名稱。

我安裝DebugDiag資料,並撞上了轉儲文件的分析,它給我的建議如下:

Please follow up with vendor Microsoft Corporation for problem resolution concerning the following file: C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\ce681fb89786c8f11e99ae5f8e9588ab\mscorlib.ni.dll.

回答

0

最有可能的,這是一個網絡問題。我最好的建議是與你的組織的網絡人員一起工作,並確定是否可能存在一些潛在的間歇性網絡問題。

解決方案可能會或可能不會在您的情況下嘗試直接連接到數據庫服務器的IP和端口,而不是。

有關解決這個確切問題的詳細信息可以在下面的MSDN博客上找到:http://blogs.msdn.com/b/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-error-locating-server-instance-specified.aspx

+0

奇怪的是消息「錯誤定位服務器/實例指定」 - 你可能會認爲這將是一個超時問題。 – Josh 2014-11-03 20:49:45

相關問題