I am getting timeouts using the Entity Framework (EF) when using a function import that takes over 30 seconds to complete. I tried the following and have not been able to resolve this issue:
I added Default Command Timeout=300000 to the connection string in the App.Config file in the project that has the EDMX file as suggested here.
This is what my connection string looks like:
I tried setting the CommandTimeout in my repository directly like so:
private TrekEntities context = new TrekEntities(); public IEnumerableGetKirksFriends() { this.context.CommandTimeout = 180; return this.context.GetKirksFriends(); }
What else can I do to get the EF from timing out? This only happens for very large datasets. Everything works fine with small datasets.
Here is one of the errors I'm getting:
System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
OK - I got this working and it's silly what happened. I had both the connection string with Default Command Timeout=300000 and the CommandTimeout set to 180. When I removed the Default Command Timeout from the connection string, it worked. So the answer is to manually set the CommandTimeout in your repository on your context object like so:
this.context.CommandTimeout = 180;
Apparently setting the timeout settings in the connection string has no effect on it.
0 answers
Hot tools Tags
Hot Questions
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
20417
7
13577
4






