ASP.NET MVC为什么我的应用程序保持重启? [英] ASP.NET MVC why does my app keep restarting?
问题描述
我有一个ASP.NET MVC网站,得到约6500次点击,每天在服务器智力共享的托管平台上。我一直在日志中看到应用程序重新启动,我想不出为什么。
I have an ASP.NET MVC website that gets about 6500 hits a day, on a shared hosting platform at Server Intellect. I keep seeing app restarts in the logs and I cannot figure out why.
我读到这里斯科特谷的文章:<一href=\"http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx\">http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx
并实现了技术,这里是我的日志显示的内容:
I've read Scott Gu's article here: http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx and implemented the technique, and here's what shows up in my log:
Application Shutdown:
_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.InitiateShutdown() at
System.Web.Hosting.PipelineRuntime.StopProcessing()
这似乎发生大约每五分钟。
It seems to occur about every five minutes.
还有没有其他的方法来调试这个?
Are there any other ways to debug this?
更新:这里是应用程序池设置由Softion提到:
UPDATE: Here are the application pool settings mentioned by Softion:
CPU
- 限制:0
- 限制操作:无操作
- 限制间隔时间:5分钟
流程模型
- 空闲超时:20分钟
- 平最大响应时间:90秒。
- 启动时限:90秒
快速失败保护
- 已启用:真
- 故障时间间隔:5分钟
回收
- 专用内存限制:100 MB
- 常规时间间隔:1740分钟(29小时)
- 请求限制:0
- 针对时报:无
- 虚拟内存限制:0
推荐答案
您可以轻松抓取通过HostingEnvironment关闭的原因。
你读斯科特谷的文章,但是你错过了意见。
You can easily grab the reason of the shutdown by HostingEnvironment. You read Scott Gu article, but you missed its comments.
var shutdownReason = HostingEnvironment.ShutdownReason;
如果原因是HostingEnvironment,检查IIS应用程序池参数控制回收。我已经把一个红点附近的每一个。检查底部的帮助框中描述自己的副本全信息。
If the reason is HostingEnvironment, check the IIS application pool parameters controlling recycling. I've put a red dot near each one. Check the description in the bottom help box in your own copy for full info.
您可以向您的供应商给你,所有这些参数设置applicationHost.config文件。他们发现,它在C:\\ WINDOWS \\ SYSTEM32 \\ INETSRV \\ config中。我敢肯定,你也可以使用一些.NET API得到它们。
You can ask your provider to give you the applicationHost.config file where all these parameters are set. They find it in C:\Windows\System32\inetsrv\config. I'm sure you can also get them using some .NET api.
有关6500打了一天,这是一个非常低的命中率,我打赌了空闲超时设置为5MN。
For 6500 hits a day, which is a very low hit rate, i'm betting the "Idle time-out" is set to 5mn.
- CPU限制0 =禁用。
- 过程模型空闲超时:20分钟(不要求20MN回收您的应用程序)。
- 启用快速失败保护(5MN)。你需要知道的最大的失败计数。如果您的应用程序在5MN比抛出该异常更个性化,将我们回收。
- 专用内存限制:100 MB。是的,你就应该剖析,这是一个低限。
- 常规时间间隔:1740分钟(29小时):将回收的每29H。
- 请求限制:0(禁用)。
- 虚拟内存限制:0(禁用)。
- 启用快速失败保护(5MN)。您需要最大的失败计数。如果您的应用程序抛出5MN比这个异常更个性化它回收。如果每回收这5MN应该检查的东西。应该有次要工作线程0未处理的异常。包装你code到一个尝试捕捉那里。
这篇关于ASP.NET MVC为什么我的应用程序保持重启?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!