Saturday, June 9

Asp.net Release mode Request timeout

On one of the projects, the administrator triggered of an event that created a flat file based on the contents of a database. This task needed around 10-20 minutes to complete. The task completed fine when in debug mode but never in release mode.

Upon talking to an Architect in the company it dawned upon me that there ASP.NET has something called "Request Timeout" (seperate than Session timeout) and this varies between the debug and the release mode. For the debug mode, the duration is a year while for release mode the request timeout is 90 seconds. Hence the abrupt request termination.

He pointed me to this:
Code Better: Peter Gekko: Timeout of an asp.net page

In short the code looks like this:
  279     protected override void OnInit(EventArgs e)
  280     {
  281         timeOut = Server.ScriptTimeout;
  282         // Give it 5 hour = (3600 * 5) = 18000 seconds
  283         Server.ScriptTimeout = 18000;
  284     }

This task can be completed using an ASP.NET Async page or by spawning a separate thread/process. I will make a post on that experience. Till then, this is workable.

Comments: Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]