Tuesday, August 7, 2012

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

You may get the following error message when trying to execute a long query.

Timeout expired. The timeout period elapsed prior to completion
of the operation or the server is not responding.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

You may be tempted to apply a connection string timeout in the config file however someone pointed out that there is a bug and this value is ignored.

The solution is to set the commandtimeout on the context object.

eg. this.context.CommandTimeout = 180;

Check out the article on stack overflow: entity framework timeouts


No comments:

Post a Comment