Thread was being aborted error when using process.waitforexit()

前端 未结 1 1054
感动是毒
感动是毒 2021-01-27 01:31

I have code below that is getting called from a while loop so it\'s executing multiple times in a row. Sometimes, but not always, I end up getting a thread was being aborted err

相关标签:
1条回答
  • 2021-01-27 01:57

    If you are calling it from an ASP.NET page the Exception you are seeing is most likely a result of you hitting the Execution timeout on the Request for the page and it is being aborted. The error is on the p.WaitforExit() line because that is where your ASP.NET page was while it was waiting for the Process you started to return. You can change the default execution timeout (110 seconds in 2.0) in the web config file for your ASP.NET app.

    <httpRuntime  executionTimeout = "600" >
    

    or via code in the page for that page only:

      HttpContext.Current.Server.ScriptTimeout
    

    http://msdn.microsoft.com/en-us/library/e1f13641.aspx

    0 讨论(0)
提交回复
热议问题