I’m building an asp.net mvc application.
In my application I have a dashboard that allows running several heavy operation.
I also have another jquery method running different polling requests, trying to get
the status of the action from the server.
From some reason the status action in the controller keeps getting timed out.
Only when the entire heavy operation is complete does the status action return
the value. I tried adding some traces, and it seems as though the server does handle the request
but from some reason no valid response is being made.
What could be causing it?
There’s a default execution timeout in ASP.NET of 110 seconds. This is controlled by the following element:
If your operation takes longer than this default timeout ASP.NET will simply bring it down. You could try increasing the default value but bear in mind that having long running operations in ASP.NET could be disastrous because you are jeopardizing precious working threads during the execution of this operation reducing the serving capabilities of your ASP.NET application.
Also if you are performing SQL queries in this operation bear in mind that there might be other timeouts related to the SqlConnection and SqlCommand that you might be hitting if you have some lengthy queries.
Another thing you should be aware of is the fact that ASP.NET Sessions are not thread safe. This means that if you have 2 parallel requests to the same ASP.NET session they will be serialized and executed sequentially and not in parallel. It is by design. So if you are using sessions in your actions it is perfectly normal that if you have a controller action that is currently running and using the session, another request from the same session will have to wait for it to finish before getting executed.