作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经尝试过在这个主题上进行一些搜索,但是我想获得更多信息。
我正在尝试在ASP.NET应用程序内启动一个新线程,该线程将处理一些需要很长时间的工作。如果我将其放在我的web.config中:
<httpRuntime executionTimeout="5" />
var testThread = new Thread(new ThreadStart(CustomClass.DoStuffThatTakesLongTime));
testThread.Start();
最佳答案
ASP.NET不了解您创建的线程-它会一直运行到AppPool回收或完成为止。
由于ASP.Net不了解此线程,因此,如果服务器认为应回收AppPool,则在任何时候都可能突然中止该线程,这不是一件好事!有关如何订阅“AppDomainIsGoingDown”事件的信息,请参见Phil Haack wrote a blog post。
关于可能导致这种情况的原因,我建议阅读blog post by Tess Ferrandez,但简而言之,它们是:
- It has been scheduled to do so
- Machine.Config, Web.Config or Global.asax are modified
- The bin directory or its contents is modified
- The number of re-compilations (aspx, ascx or asax) exceeds the limit specified by the setting in machine.config or web.config (by default this is set to 15)
- The physical path of the virtual directory is modified
- The CAS policy is modified
- The web service is restarted
- (2.0 only) Application Sub-Directories are deleted
关于asp.net - ASP.NET何时会杀死新线程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8805173/
嘿。本周的一个教程,其中一个问题要求通过使用其他函数 formatLine 和 formatList 创建一个函数 formatLines,以格式化行列表。 我的代码是这样的; type Line =
我是一名优秀的程序员,十分优秀!