现在的位置: 首页 > 综合 > 正文

asp.net中如何把应用程序错误写入事件日志(注册事件源)

2013年09月10日 ⁄ 综合 ⁄ 共 232字 ⁄ 字号 评论关闭

 using System.Diagnostics;

 using System.Web;

 

 String EventSource = ConfigurationManager.AppSetting["Log_Source"];

 Exception e = Server.GetLastError().GetBaseException();

 EventLog.WriteEntry(EventSource,e.message,EventLogEntryType.Error);

 

 

 

抱歉!评论已关闭.