简体   繁体   English

不活动的应用程序池在线程上关闭

[英]Inactive Application Pool shut down on a thread

In my web service that takes about one hour and half to get its work done I am doing my processing in it in a Task.Factory.Run() method and my web service was inside the default application pool in IIS on the VM machine. 在大约需要一个半小时完成工作的Web服务中,我正在使用Task.Factory.Run()方法在其中进行处理,并且Web服务位于VM计算机上IISdefault application pool After about 30 minutes my WebService stopped working. 大约30分钟后,我的Web服务停止工作。 I went to windows event log and its was default application pool was shut down after 20 minutes due to inactivity on the worker thread. 我进入Windows事件日志, 由于工作线程不活动 ,其默认应用程序池在20分钟后关闭。 So does that mean this is the reason my WebService also stopped working? 难道这就是我的WebService也停止工作的原因吗? And if yes they why does it think it was inactive? 如果是的话,他们为什么认为它不活跃? Is it because of Task.Factory.Run() ? 是因为Task.Factory.Run()吗?

This is indeed the reason. 这确实是原因。 The web service was inactive because it didn't receive any requests. 该Web服务处于非活动状态,因为它没有收到任何请求。

WebServices should be a stateless layer for requests and responses, handled by the application pool. WebServices应该是用于请求和响应的无状态层,由应用程序池处理。 If you need to perform long term processing, you should do it in a different process (for example, a windows service you queue work for using WCF inter-process communication). 如果需要执行长期处理,则应在其他过程中进行处理(例如,将使用WCF进程间通信的工作排队到Windows服务中)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM