如何检查IIS或ASP.NET工作进程是否已自动重新启动我的网站?
我想知道我是否能追踪到这种情况,因为如果这种情况经常发生,我想知道它的根本原因。是否有时间戳日志记录可用于在IIS中重新启动我的站点,我如何以编程方式跟踪此情况 感谢大家。在Global.asax上如何检查IIS或ASP.NET工作进程是否已自动重新启动我的网站?,asp.net,iis,tracking,Asp.net,Iis,Tracking,我想知道我是否能追踪到这种情况,因为如果这种情况经常发生,我想知道它的根本原因。是否有时间戳日志记录可用于在IIS中重新启动我的站点,我如何以编程方式跟踪此情况 感谢大家。在Global.asax上 void Application_Start(object sender, EventArgs e) 和 void Application_End(object sender, EventArgs e) 在应用程序启动和结束时调用。您可以使用它们来记录它。现在要了解池重新启动的原因,您可以简
void Application_Start(object sender, EventArgs e)
和
void Application_End(object sender, EventArgs e)
在应用程序启动和结束时调用。您可以使用它们来记录它。现在要了解池重新启动的原因,您可以简单地检查池的设置,您可能有很多原因需要进行设置,可能是您设置了时间限制,可能是内存限制,可能是其他设置。。。您可以检查并更改它们。在Global.asax上
void Application_Start(object sender, EventArgs e)
和
void Application_End(object sender, EventArgs e)
在应用程序启动和结束时调用。您可以使用它们来记录它。现在要了解池重新启动的原因,您可以简单地检查池的设置,您可能有很多原因需要进行设置,可能是您设置了时间限制,可能是内存限制,可能是其他设置。。。您可以检查并更改它们。您可以在Global.asax application\u 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);
}
}
您可以在Global.asax application\u 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);
}
}
使用WMI查询事件日志。使用WMI查询事件日志。我已经知道此事件,我们正在使用它。谢谢。我已经知道这个活动,我们正在使用它。谢谢。非常感谢,这似乎真的告诉我们我们在寻找什么。非常感谢,这似乎真的告诉我们我们在寻找什么。