2

I am working on an entity framework inside asp.net mvc 5. and the sql server is very slow , so whenever i try to access a page that is connected to the Db i receive the following error:-

Server Error in '/' Application.
--------------------------------------------------------------------------------


The wait operation timed out 
  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.ComponentModel.Win32Exception: The wait operation timed out

Source Error: 


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

but i can not find a way to increase the timeout inside my entity framework class ? My connection string inside web.config looks as follow:-

<add name="***Entities" connectionString="metadata=res://*/Models.Model2.csdl|res://*/Models.Model2.ssdl|res://*/Models.Model2.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=*******;initial catalog=TMSres;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

How to increase the Timeout session between Entity framework & Sql Server?

Thnaks

1

1 Answer 1

2

You can set it by

// Specify a timeout for queries in this context, in seconds.<br>
context.CommandTimeout = 120;

http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.commandtimeout(v=vs.110).aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.