1

當我的域服務被調用以返回實體框架對象時,我收到數據庫連接超時錯誤。Silverlight實體框架DataContractSurrogate錯誤

「An error occurred while executing the command definition. See the inner exception for details. 
InnerException message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.」 

我最初以爲有可能是:被執行,像這樣的EntityQuery負荷運轉後,我使用Silverlight 4與Visual Studio 2010

最初的錯誤是被困在Silverlight客戶端側與SQL Server數據庫的錯誤,因爲錯誤似乎只是突然出現,但我發現我已經在域服務類追查更深層次的錯誤,看起來像這樣:

Function evaluation timed out. 
The type 'MyProject.Web.Models.MyCustomEntity' exists in both 'MyProject.Web.dll' and 'DataContractSurrogates_cfc4b316-5204-4fc6-830c-d91c6fc0b24b' 

這個職位也有類似的錯誤,但他們的資源lution不幫我: silverlight The type exists in both and DataContractSurrogates

我有點不知所措解釋這一點,真的很感謝你的幫助!

回答

2

通過將RIA域服務超時設置爲5分鐘(儘管查詢返回比默認超時更快)解決了此問題。

不知道爲什麼我得到了我所得到的特定錯誤。並不確定爲什麼查詢似乎超時。這是一個幾乎立即返回的小查詢。

我發現這blog post有一個易於遵循的如何設置請求超時域服務的解釋:

Solution was increase RIA domain service timeout: