ServiceActivationException:无法分派请求,因为虚拟应用程序正在关闭

时间:2014-02-18 16:33:17

标签: c# asp.net iis

我们的虚拟应用程序关闭时遇到问题。站点正在运行ASP.NET 4.5

例外摘要:

System.InvalidOperationException: Request to the service at '~/Services/ServiceExceptionLogger.svc' cannot be dispatched because the virtual application at '/Site' is shutting down.

堆栈跟踪:

System.ServiceModel.ServiceActivationException: Request to the service at 
'~/Services/ServiceExceptionLogger.svc' cannot be dispatched because the virtual application
 at '/Site' is shutting down. ---> System.InvalidOperationException: Request to the service at '~/Services/ServiceExceptionLogger.svc' cannot be dispatched because the virtual 
application at '/Site' is shutting down.
 --- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)

或者这是在事件日志中显示的另一个版本

堆栈追踪:

System.ServiceModel.ServiceActivationException: Request to the service at '~/Services/Service.svc' cannot be dispatched because the virtual application at '/Site' is shutting down. ---> System.InvalidOperationException: Request to the service at '~/Services/Service.svc' cannot be dispatched because the virtual application at '/Site' is shutting down.
   --- End of inner exception stack trace ---
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)

以前有人有任何想法或看过这个吗?似乎在我们的某个环境中频繁发生,例如每天10次以上。在质量保证环境中,它根本没有发生。两个环境的空闲超时设置为20分钟。超时20分钟的原因是为了避免浪费内存

更新1:在https://webmasters.stackexchange.com/questions/17630/which-event-log-file-does-iis-7-app-pool-log-to/17633#17633?newreg=d562bf378cc545b49a7ea8f2a3c1b48d

找到有关记录应用程序池回收的一些补充信息

更新2:显然,当发生上述异常时,应用程序池不会回收。我们正在观察任务管理器中的进程,并且在发生此异常时它不会关闭或减少内存。此外,发生此异常时不会发生日志条目(请参阅更新1)

2 个答案:

答案 0 :(得分:3)

将此升级到Microsoft支持后,我们认为此问题是.NET 4.5.1的错误。它最常发生在集成模式下运行,但也发生在经典模式下,尽管频率较低。我们无法确定实际案例或问题,但似乎没有在较旧的.NET运行时发生。

答案 1 :(得分:2)

假设这就是您所遇到的问题:

在IIS中,应用程序池在不活动后每隔约20分钟(我不记得确切的默认时间)自行回收。

虽然在IIS管理器下的应用程序池的“高级设置”下,这是可以更改的。

相关问题