Asp.net web api 带Elmah的Web API 2-如何记录操作之外的异常?

Asp.net web api 带Elmah的Web API 2-如何记录操作之外的异常?,asp.net-web-api,exception-handling,asp.net-web-api2,elmah,Asp.net Web Api,Exception Handling,Asp.net Web Api2,Elmah,我正在将Web API 2与Elmah一起使用,我希望Elmah能够捕获在控制器中的操作之外发生的异常 例如: protected void Application_Start() { //Exception is thrown here. I want Elmah to catch it. } 在Startup.Auth.cs中: public void ConfigureAuth(IAppBuilder app) { //Exception is thrown here.

我正在将Web API 2与Elmah一起使用,我希望Elmah能够捕获在控制器中的操作之外发生的异常

例如:

protected void Application_Start()
{ 
    //Exception is thrown here. I want Elmah to catch it.
}
在Startup.Auth.cs中:

public void ConfigureAuth(IAppBuilder app)
{
    //Exception is thrown here. I want Elmah to catch it.
}
  • Elmah版本是1.2.2
  • 我正在使用
Elmah.Contrib.WebApi仅从操作中捕获异常是否有原因

如果是由desgin编写的,那么除了使用contrib库之外,还有其他方法可以捕获操作之外的异常吗