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

Sam*_*eer 5 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.
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

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)
Run Code Online (Sandbox Code Playgroud)

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

堆栈跟踪:

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)
Run Code Online (Sandbox Code Playgroud)

任何人有任何想法或以前见过这个?似乎在我们的某个环境中频繁发生,例如每天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)

Sam*_*eer 3

在将此问题上报给 Microsoft 支持后,我们认为此问题是 .NET 4.5.1 的一个错误。在集成模式下运行时最常发生这种情况,但在经典模式下也会发生,但频率要低得多。我们无法查明实际情况或问题,但它似乎没有发生在较旧的 .NET 运行时上。