简体   繁体   中英

asp.net mvc application timeouts in production even when debug is set to true. Can anyone help me on this

We have an ASP.Net MVC application. It has been published in the Production environment and debug is set to true (not sure why) in WEb.config.

compilation batch="true" debug="true" targetFramework="4.5"

But still the application timeouts.

I want to make debug="false" and add the below tag.

httpRuntime executionTimeout="43200" maxRequestLength="104856" targetFramework="4.5"

But if the application timeouts when debug="true" then I think it will timeout even when debug="false" irrespective of the executionTimeout.

Is there any way we can set the timeout via Global.asax.cs?

Edit 1: The application gets a timeout if the process runs for more that 2 minutes.

So that means the session is still alive.

<sessionState mode="InProc" cookieless="false" timeout="60" />

For the database I have added command timeout of 5 minutes (just for testing purpose) but still there is a timeout.

Edit 2: After browsing through the logs this was the error.

The remote host closed the connection. The error code is 0x800703E3

User session might be ending, which might make everything else irrelevant:

Set this in IIS: sessionState timeout="120"

Or Web.config:

<configuration>
<system.web>
<sessionState mode="InProc" timeout="120"></sessionState>
</system.web>
</configuration>

Default is 20 minutes, so your 12 hour httpruntime executiontimeout would be irrelevant.

Make sure you have adequate connection timeout for initial database connection AND command timeout for your database if you have long running scripts. Check logs and load a page with no database dependency as a test.

Also, Microsoft documentation states:

“This time-out applies only if the debug attribute in the element is set to false.”

https://docs.microsoft.com/en-us/dotnet/api/system.web.configuration.httpruntimesection.executiontimeout?view=netframework-4.7.2

So, with debug currently set to true, the executiontimeout setting will not do anything until debug is changed to false.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM