如何检查IIS或ASP.NET辅助进程自动重新启动我的网站? [英] how to check if IIS or ASP.NET worker process has restarted my website automatically?
本文介绍了如何检查IIS或ASP.NET辅助进程自动重新启动我的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道我是否可以跟踪这一点,因为如果经常发生这种情况,我想知道它的根本原因。有没有时间戳记录可我在IIS站点的重新启动,我如何追踪这个编程?
I want to know if I can track this, because if this happens frequently I want to know root cause of it. Is there any time stamp logging available for restarting of my site in IIS, How can I track this programmatically?
感谢所有。
推荐答案
您可以登录原因Global.asax中Application_End应用程序重新启动:
You could log reason for application restart in Global.asax Application_End :
protected void Application_End(object sender, EventArgs e)
{
HttpRuntime runtime = (HttpRuntime)typeof(System.Web.HttpRuntime).InvokeMember("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null);
string shutDownMessage = "";
if (runtime != null)
{
shutDownMessage = Environment.NewLine + "Shutdown: " +
(string)runtime.GetType().InvokeMember("_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null) +
Environment.NewLine + "Stack: " + Environment.NewLine +
(string)runtime.GetType().InvokeMember("_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null);
}
}
这篇关于如何检查IIS或ASP.NET辅助进程自动重新启动我的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文