User974256540 posted
Hi there.
We have a WebApi service (which is OData service) and we would like to terminate requests (by IIS) which take too long time.
(the reason they take long time is bad database query, but that is another story).
The thing is that no matter what have as "executionTimeout", it doesn't have any effect whatsoever.
<system.web>
<compilation targetFramework="4.7.2"/>
<httpRuntime targetFramework="4.7.2" executionTimeout="5" />
</system.web>
Even if you have a fresh, new WebApi project (create via VS --> new project -> WebApi example) and set the parameter, it will never terminate the request.
How do we know? , well, for test purposes, we set Thread.Sleep
// GET api/values/5
public string Get(int id)
{
Thread.Sleep(Int32.Parse(ConfigurationManager.AppSettings["mytimeout"]));
return "value";
}
No matter how long I set the thread sleep, it does not terminate! It can wait for minutes and finally return "value".
The goal is to terminate requests if they take too much time (let say 20 seconds is a max).
The compilation "debug" parameter is set to False.
WebApi is from nuGet v. 5.2.7