Microsoft Application Block for .NET
- Exception
工作流The flow of logic when the Exception Management Application Block is used to publish an exception illustrated in the preceding diagram is as follows:
1) The application throws an exception, which can be derived from the BaseApplicationException class provided in the Exception Management Application Block.
2) The application calls the Publish method of the ExceptionManager class.
3) The ExceptionManager class uses the ExceptionManagerSectionHandler class to retrieve the application’s exception management settings.
4) The exception management settings in the application’s configuration file (if any) are read to determine how the exception should be published.
5) If no settings are found, the exception is published in the Windows Event Log by using the DefaultPublisher class. If the application has exception management settings configured, the publishers listed in the configuration file, which can include the DefaultPublisher class and custom publisher classes, are used to publish the exception. All publishers implement at least one of the interfaces defined in the Interfaces assembly.
6) If an exception occurs while publishing through a custom publisher, the exception manager raises a CustomPublisherException, and uses the default publisher to publish it in the Windows Event Log.
Cache 的主要接口
· IExceptionPublisher
例外发布器,Exception Framework提供的有:DefaultPublisher(发布到系统的事件日志)
· IExceptionXmlPublisher
主要类
ExceptionManager
配置文件
主要对使用的例外发布器进行配置。
调用方法
ExceptionManager.Publish(Exception, additionalInfo);
其他
为确保你的OS的事件日志功能已启动,你应该使用ExceptionManagerInstaller类在安装时去安装它
本文地址:http://com.8s8s.com/it/it42338.htm