Elmah: ErrorLog_Filtering event handler not called under IIS7

前端 未结 1 1870
心在旅途
心在旅途 2021-01-15 16:46

I enable error log filtering within Elmah and want to do it programmatically in a ErrorLog_Filtering event handler. It works well under Visual Studio dev server but as soon

相关标签:
1条回答
  • 2021-01-15 17:39

    The reason your handler in not being called under IIS 7 is because you named the module differently. You named it ErrorLog under system.web/httpModules and then Elmah.ErrorLog under system.webServer/modules.

    Handling module events in Global.asax works via a naming convention where the event handler must be named after the module name as found in the configuration followed by an underscore (_), followed by the event name. ErrorLog_Filtering is fine and matches the registered name under system.web/httpModules and which is being picked up by the Visual Studio Development Server. You just need to make sure that you match up all the names and it should work in both environments.

    See also: Programmatically log error and send email

    0 讨论(0)
提交回复
热议问题