Azure云服务应用程序池回收后死亡 [英] Azure Cloud Service is dead after Application Pool Recycle

查看:136
本文介绍了Azure云服务应用程序池回收后死亡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个部署了Azure的云服务WebRole的WebAPI只有一个实例。
我注意到,如果我等待一段空闲时间(无HTTP请求),再后来就服务是死了,它的每个请求将导致以下回应:

I have a deployed Azure Cloud Service WebRole WebAPI with only one instance. I have noticed that if I wait some idle time (No HTTP Requests), Then later on the service is dead, and every request to it results in the following response:

{
    Message: "An error has occurred."
}

Azure的管理仪表板说,实例的状态正在运行。远程桌面显示,应用程序池和网站都在运行,而且所有需要的服务都在运行。

我找不到任何相关错误信息的任何地方...

The Azure management dashboard says the instance status is Running. Remote desktop reveals that the Application pool and the web site are both running, and that all the services needed are running.
I can't find any relevant error message anywhere...

我发现上述情况,唯一的解决办法是执行重新启动,以实例的虚拟机。

The only resolution I found to the above situation is to perform a reboot to the Instance VM.

由于我认为上面是空闲时间的结果,我看了一下,发现了默认应用程序池本身有一个空闲超时属性设置为20分钟,导致关停后的应用程序池里面的工作进程空闲超时到达。我设法重现该问题不通过手动触发应用程序池回收等待超时。

Since I assumed that the above is a result of idle time, I looked and found out that by default the Application Pool itself has an Idle Timeout property set to 20 minutes, resulting in shutting down the worker process inside the Application Pool after idle timeout reached. I managed to reproduce the problem without waiting for the timeout by manually triggering Application Pool Recycling.

我认为我有某种问题,我的服务,无法正确地从关闭恢复。作为一个证明,一个干净的外装即用的服务项目没有使用相同的行为造成的。

I assume that I have some kind of problem with my service, unable to correctly recover from shut down. As a proof, A clean out-of-the-box service project did not result with the same behavior.

哪些原因会导致这样的问题?

任何人都可以点我调试这个正确的方向呢?

我在哪里可以找到可能有帮助的错误跟踪消息?

What can cause such a problem?
Can anyone point me to the correct direction of debugging this?
Where can I possibly find a helpful error trace message?

修改

我使用Autofac海委会,它突然发生,我认为这个问题可能是国际奥委会循环后,不知何故被清除。我里面执行的Application_Start在国际奥委会注册() 的Global.asax.cs 的。

难道是这个问题?

Edit:
I am using Autofac for IoC, and it suddenly occurred to me that the problem might be that the IoC is somehow cleared after the recycle. I am performing the IoC registrations inside Application_Start() of Global.asax.cs.
Could it be the problem?

推荐答案

当在AppDomain被IIS组件回收只按需加载。尝试使用 GetReferencedAssemblies 方法上的 System.Web.Compilation.BuildManager 来得到引用的程序集的列表,而不是

When the AppDomain is recycled by IIS assemblies are only loaded on demand. Try using the GetReferencedAssemblies method on System.Web.Compilation.BuildManager to get a list of the referenced assemblies instead.

var assemblies = BuildManager.GetReferencedAssemblies().Cast<Assembly>();

这应该强制引用的程序被加载到的AppDomain 立即使其可用于模块扫描。

That should force the referenced assemblies to be loaded into the AppDomain immediately making them available for module scanning.

这篇关于Azure云服务应用程序池回收后死亡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆