2

HealthMonitoring 是否具有捕获 404 错误的内置事件?我已经尝试设置所有事件(通过使用 webBaseEvent)并且我已经搜索了两天,但我找不到或触发未找到文件的事件。

我可以创建自己的,但希望有一个内置事件。

4

1 回答 1

1

不,它没有。您必须创建一个自定义事件(来自 webrequesterrorevent)才能让 HM 为您跟踪它。

如何:global.asax 中的 Application_Error 中的类似内容(来自内存)-

public void Application_Error()
{
    var exception = Server.GetLastError() as HttpException;
    if (exception != null && exception.GetHttpCode() == 404)
    {
       //custom error
       new Http404Event(this, exception).Raise();
    }
}
于 2011-05-25T15:14:18.400 回答