Search code examples
asp.net.netprocessbackground-process

How to set timeout on a dot-net process


I have a web page that is supposed to start a long-running process. By long-running here I mean it might take an hour or so. I don't want the web page to sit there for an hour, so I create a Process object, start it up with no wait, and then return an "ok I started it" message. (The process updates some files, and I plan to have a log that the user can check to see if it's done. That's not the issue.) My problem is, it's timing out at 20 minutes. If I modify parameters on the job so it runs in less than 20 minutes everything works fine, it does its updates, the unicorns frolic in the pasture, and everything is good. But there's a timeout somewhere killing it at 20 minutes.

I searched for a property on Process to specify the time limit, and no luck. This limit must be settable somewhere. Any idea where?


Solution

  • This is not the process issue but the feature of the IIS to go to idle after some inactivity and the default timeout is exactly 20 minutes.

    So you can try following:

    1) Go to IIS Server Manager -> select your application pool -> choose advanced settings and set another value for Idle Time-out (minutes)

    2) If you are planning to deploy your application on other servers, which settings you can't change, then you can create a timer which will ping the server every 15 minutes which will prevent it's idle mode.

    enter image description here