Last post Jun 14, 2019 03:42 PM by bruce (sqlwork.com)
Jun 14, 2019 12:38 PM|LukRed|LINK
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.
<httpRuntime targetFramework="4.7.2" executionTimeout="5" />
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)
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
Jun 14, 2019 03:39 PM|DA924|LINK
Now, you could have a WebAPI setting in front of a WCF Web service with the WebAPI being a WCF client to the WCF Web service. The WCF service timeout default is 5 seconds, and that exception is going to be thrown by the WCF service I guarantee. :)
Jun 14, 2019 03:42 PM|bruce (sqlwork.com)|LINK
if you run in debug mode, the execution timeout is not honored.