Thursday, June 2, 2022

The wait operation timed out C# ASP.NET commandtimeout - How to execute long time queries - maximum file upload file size in web.config

 if you are getting error :- System.ComponentModel.Win32Exception: The wait operation timed out

//default to 30seconds

dataadapter.SelectCommand.COmmandTimeOut = 180;

or set it to 0, it will act as infinity

or

 <connectionStrings>

add name="mConnectionString" connectionString="Server=DESKTOP-EUCFT2Q; Database=ESDM_NIELIT_NEW; UID=sa; PWD=25032022; Connection Timeout = 2; Min Pool Size=20; Max Pool Size=200" providerName="System.Data.SqlClient"/>

  </connectionStrings>


or

Open SQL server Management studio

>Click on Option

> Click on connection Properties tab

>Change connection time-out to 0

or 

[Win32Exception (0x80004005): The wait operation timed out]
Error-dataadapter.fill method to run querry
If Sql querry takes more than 90 seconds from database fetching data
or 
Error occurs due to debug attribute, in web.config it is set to false. Make it to true.
Change web.config 
<Configuration>
<System.web>
<httpRuntime executionTimeout="10" maxRequestLength="20480" enableVersionHeader="false" requestPathInvalidCharacters="*,%,:,\"/>
</system.web>
<Configuration>
or set it to 0, it will act as infinity
OR

Change Machine.config in %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\Config\
Goto 
<httpRuntime executionTimeout="90" maxRequestLength="4096" appRequestQueueLimit="100" />
 
default values are as below:-
CommandTimeout = 30
ConnectionTimeout = 30 

or
How to execute long time queries
Change executionTimeout to 3000(it is in seconds), default value is 2400

<httpRuntime maxRequestLength="629145600" executionTimeout="2400" requestValidationMode="2.0" />

<requestLimits maxAllowedContentLength="629145600" />


maxAllowedContentLength will show the maximum file upload file size.

reference:- https://docs.flexera.com/workflowmanager2016/Content/helplibrary/AMS_wcHTTPLength.htm





No comments:

Post a Comment