Changing httpRuntime settings during execution

  • Thread starter Thread starter Artem Kliatchkine
  • Start date Start date
A

Artem Kliatchkine

Hi All,

HttpRuntime settings such as executionTimeout are normally set in
Web.config. Is it possible to change them at runtime?

I have a rarely executed method which works long time (sometimes -
hours). For this particular method I would like to change the
executionTimeout, keeping it unchanged for other ones.

Thanks,
Artem
 
Artem,

You can alter the timeout programatically by setting the ScriptTimeout of
the HttpServerUtility class (typically exposed via the Server object, e.g.:
Server.ScriptTimeout = 60). However, allowing any request to be processed
for several hours is not necessarily a great idea since it can have a
negative impact on the performance and availability of your application as a
whole. If at all possible, you might want to consider moving this process
into a scheduled task or Windows service.

HTH,
Nicole
 
Back
Top