ASP.NET 的性能监控

MSDN原文 ASP.NET Performance Monitoring, and When to Alert Administrators 下载源代码

Monitoring Performance Counters
Monitoring the Event Log
Monitoring the W3C and HTTPERR Logs
Other Resources Used to Monitor ASP.NET
Understanding the Performance Counters
   .NET CLR Exceptions Counter
   .NET CLR Loading Counters
   .NET CLR Memory Counters
   ASP.NET Counters
   ASP.NET Applications Counters
   Process Counters
   Processor Counter
   Memory Counter
   System Counter
   Web Service Counters
Conclusion

主要讨论的是如何使用ASP.NET的性能计数器。主要包括以下几个方面

  • Processor(_Total)\% Processor Time
  • Process(aspnet_wp)\% Processor Time
  • Process(aspnet_wp)\Private Bytes
  • Process(aspnet_wp)\Virtual Bytes
  • Process(aspnet_wp)\Handle Count
  • Microsoft® .NET CLR Exceptions\# Exceps thrown / sec
  • ASP.NET\Application Restarts
  • ASP.NET\Requests Rejected
  • ASP.NET\Worker Process Restarts (not applicable to IIS 6.0)
  • Memory\Available Mbytes
  • Web Service\Current Connections
  • Web Service\ISAPI Extension Requests/sec

如何在Application_Error事件中监视出错信息。

void Application_Error(Object sender, EventArgs ea) {
    StringBuilder message = new StringBuilder();
   
    if (Request != null) {
        message.AppendFormat(uriFormat, Request.Path);
    }
 
    if (Server != null) {
        Exception e;
        for (e = Server.GetLastError(); e != null; e = e.InnerException) {
            message.AppendFormat(exceptionFormat,
                                 e.GetType().Name,
                                 e.Message,
                                 e.StackTrace);
        }
    }

    if (!EventLog.SourceExists(sourceName)) {
        EventLog.CreateEventSource(sourceName, logName);
    }

    EventLog Log = new EventLog(logName, serverName, sourceName);
    Log.WriteEntry(message.ToString(), EventLogEntryType.Error);

    //Server.ClearError(); // uncomment this to cancel the error
}


.NET CLR Exceptions Counter  当运行Response.Redirect() Server.Transfer() Response.End() 会抛出ThreadAbortException错误,如果不想抛出错误,Response.Redirect(url,false)。

Application Restarts 以下为可能引发Application Restart 的情况

  • Modification of machine.config, web.config, or global.asax.
  • Modification of the application's bin directory or its contents.
  • When the number of compilations (ASPX, ASCX, or ASAX) exceeds the limit specified by <compilation numRecompilesBeforeAppRestart=/>.
  • Modification of the physical path of a virtual directory.
  • Modification of the code-access security policy.
  • The Web service is restarted.

转载于:https://www.cnblogs.com/leonardleonard/archive/2005/01/05/1928452.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值