托管在 aspnix 共享主机上的 asp.net mvc 2 应用程序随机意外关闭
我有一个非常简单的 mvc 2 应用程序托管在 aspnix http://www.aspnix.com 的共享托管平台上。
有时,用户在网站导航期间丢失身份验证(我使用标准会员资格提供商)并被重定向到登录页面。 经过一番研究后,我开始怀疑会话由于应用程序重新启动而丢失,因此我决定安装和配置运行状况监控服务,以跟踪应用程序关闭和重新启动。
在向应用程序发出一些请求后,我开始在运行状况监控日志中看到以下条目:
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所有未处理的异常的事件都没有结果。
有什么想法吗?
I have a very simple mvc 2 application hosted on the shared hosting platform at aspnix http://www.aspnix.com.
Some times users lost authentication (I use the standard membership provider) during the navigation of the site and are redirected to the login page.
After some research I begin to suspect that the session is lost due to a restart of the application so I decided to install and configure the health monitoring service in order to track for Application shutdown and restart.
After some requests to the application I start to see the following entry in the health monitoring log:
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!
and then a restart of the application.
Then I contacting the aspnix support and it says that the server is ok, that some other big site run with no issue on the same server and that it is probably a problem of my application.
So I start to investigate in my application but I cannot found any problem.
I also realize that the shutdown appears also when I request static resource like, for example a png image!
After some research I found this interesting post on the Scott Gu blog:
http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx
So I intercept the Application_End event in the global.asax as Scott teach and then I send a mail every time my application shutdown... and the content is every time the same:
_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()
I know that the the causes of a restart can be changes of the web.config, changes in the bin or aspx files, overuse of memory etc...
But in this case the application shutdown appear also with the request of a static resource and also the other part of the application are very simple and use only the standard membership provider and some linq to sql query...
I also have subscribed to the Application_Error event for all the unhandled exception with no results.
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
aspnix 可能是问题所在。自从从它们切换到 Amazon EC2 以来,我获得了更可靠、更快速的服务。
aspnix is likely the problem. Since switching from them to Amazon EC2 I've had much more reliable and faster service.