开发者

Silverlight Entity Framework DataContractSurrogate Error

开发者 https://www.devze.com 2023-03-03 11:45 出处:网络
I\'m receiving a database connection timeout error when my Domain Service is called to return an Entity Framework object.I\'m using Silverlight 4 with Visual Studio 2010.

I'm receiving a database connection timeout error when my Domain Service is called to return an Entity Framework object. I'm using Silverlight 4 with Visual Studio 2010.

The initial error is trapped on the Silverlight client side after the EntityQuery Load operation is executed and looks like this:

“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.”

I initially thought there might be an error with the SQL Server database, since the error just seemed to suddenly 开发者_开发问答appear, but I found an error I've tracked down deeper in the Domain Service class which looks like this:

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

This post had a similar error, but their resolution doesn't help me: silverlight The type exists in both and DataContractSurrogates

I'm kind of at a loss for explaining this and would really appreciate your help!


Solved this problem by setting the RIA domain service timeout to a value of 5 minutes (though the query returns much faster than the default timeout).

Still not sure why I got the particular error I did get. And not sure why the query seemed to timeout. It is a small query that returns almost instantly.

I found that this blog post had an easy to follow explanation of how to set the request timeout for the domain service:

Solution was increase RIA domain service timeout:

0

精彩评论

暂无评论...
验证码 换一张
取 消