How do I enable Application Insights server telemetry on WebApi project that uses OWIN?

后端 未结 3 456
一整个雨季
一整个雨季 2021-02-05 09:37

We are having a bunch of problems (read long response times) with a couple of projects in production and wanted to see exactly what was happening on the server. I then proceeded

3条回答
  •  名媛妹妹
    2021-02-05 10:09

    This is an old question but it was still in the top 3 results on searches for "web api application insights owin". After lots of searching and not a lot of answers that didn't require us to write our own middleware or explictly instrumenting everything. We came across an extension package that made things super simple:

    Here's the Github Repository for it and the associated NuGet Package

    For those too lazy to look at the links, all that was needed to be added was:

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseApplicationInsights();
    
            // rest of the config here...
        }
    }
    

    and add this to your ApplicationInsights.Config

    
        
        
    
    

提交回复
热议问题