1

我在 aspnix http://www.aspnix.com的共享托管平台上托管了一个非常简单的 mvc 2 应用程序。

有时用户在网站导航期间失去身份验证(我使用标准会员提供程序)并被重定向到登录页面。经过一些研究,我开始怀疑会话由于应用程序的重新启动而丢失,因此我决定安装和配置健康监控服务,以跟踪应用程序的关闭和重新启动。

在对应用程序发出一些请求后,我开始在运行状况监控日志中看到以下条目:

Event code: 1002 Event message: Application is shutting down. Reason: Hosting environment is shutting down. Event time: 12/8/2010 8:16:33 AM Event time (UTC): 12/8/2010 3:16:33 PM Event ID: d92fbba0487b4bab97bd7eff4b0083bb Event sequence: 38 Event occurrence: 1 Event detail code: 50002  Application information:     Application domain: /REMOVED FOR PRIVACY!     Trust level: Full     Application Virtual Path: /     Application Path: C:\REMOVED FOR PRIVACY!     Machine name: REMOVED FOR PRIVACY!  Process information:     Process ID: 12516     Process name: w3wp.exe     Account name: REMOVED FOR PRIVACY! 

然后重新启动应用程序。

然后我联系了 aspnix 支持,它说服务器正常,其他一些大型站点在同一台服务器上运行没有问题,这可能是我的应用程序的问题。

所以我开始在我的应用程序中进行调查,但我找不到任何问题。

我还意识到,当我请求静态资源(例如 png 图像)时,也会出现关机!

经过一番研究,我在 Scott Gu 博客上发现了这篇有趣的帖子: http ://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx

因此,我按照 Scott 的教导截取 global.asax 中的 Application_End 事件,然后每次我的应用程序关闭时发送一封邮件......并且内容每次都相同:

_shutDownMessage=HostingEnvironment initiated shutdown
HostingEnvironment caused shutdown

_shutDownStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
  at System.Environment.get_StackTrace()
  at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
  at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
  at System.Web.Hosting.PipelineRuntime.StopProcessing()

我知道重启的原因可能是 web.config 的更改、bin 或 aspx 文件的更改、内存的过度使用等......但在这种情况下,应用程序关闭也会出现在静态资源的请求和应用程序的其他部分也非常简单,只使用标准会员提供程序和一些 linq to sql 查询......

我还为所有未处理的异常订阅了 Application_Error 事件,但没有结果。

任何想法?

4

1 回答 1

0

aspnix 可能是问题所在。自从从他们切换到 Amazon EC2 后,我获得了更可靠、更快速的服务。

于 2011-05-01T23:25:33.393 回答