Aspnetcore: How to disable application insights in asp.net core 2.0?

Created on 8 Jun 2017  ·  85Comments  ·  Source: dotnet/aspnetcore

I've been attempting to familiarize myself with the asp.net core 2.0 stack. I created a new project and with every request I see output from applications insights in the debug window. As this is just for my own learning I have no desire to use application insights and would rather not have it cluttering the debug window.

Most advice I've found says to just remove the nuget package, however AI is not installed via nuget. The only nuget packages installed are Microsoft.AspNetCore and Microsoft.NETCore.App, neither of which depend on AI. Further more I can not find any reference to AI in my services or appbuilder in my startup. Because the lack of configuration objects and the lack of a nuget package I would expect AI to not be in my project at all, yet it is still logging something.

In short, AI is logging to the debug window, even though it appears not to be part of my project. How can I go about disabling this?

Most helpful comment

I don't want AI at all.

+1

All 85 comments

@BillHiebert

After further investigation this appears to be tied to visual studio as debugging outside of VS (using vscode or just running on the command line) does not show these messages. To help make sure everyone is on the same page, here is the output I observe in the debug window in VS after one HTTP request.

Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:62731/  
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 DEBUG http://localhost:62731/  0
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.3967075Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Request starting HTTP/1.1 GET http://localhost:62731/","severityLevel":"Information","properties":{"Method":"GET","Host":"localhost:62731","CategoryName":"Microsoft.AspNetCore.Hosting.Internal.WebHost","Scheme":"http","Protocol":"HTTP/1.1","Path":"/","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.3967004Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"DEBUG /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df49","ai.operation.parentId":"|WC1843-a3501fd0-ac63df49.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Request starting HTTP/1.1 DEBUG http://localhost:62731/  0","severityLevel":"Information","properties":{"ContentLength":"0","Method":"DEBUG","Host":"localhost:62731","CategoryName":"Microsoft.AspNetCore.Hosting.Internal.WebHost","Scheme":"http","Protocol":"HTTP/1.1","Path":"/","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.4617268Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"DEBUG /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df49","ai.operation.parentId":"|WC1843-a3501fd0-ac63df49.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAF9\" completed keep alive response.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel","ConnectionId":"0HL5IC4UQLAF9","{OriginalFormat}":"Connection id \"{ConnectionId}\" completed keep alive response.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 129.444ms 200 
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.4703409Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"DEBUG /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df49","ai.operation.parentId":"|WC1843-a3501fd0-ac63df49.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Request finished in 129.444ms 200","severityLevel":"Information","properties":{"CategoryName":"Microsoft.AspNetCore.Hosting.Internal.WebHost","StatusCode":"200","ElapsedMilliseconds":"129.444","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.4763186Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"The request path / does not match a supported file type","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware","{OriginalFormat}":"The request path {Path} does not match a supported file type","Path":"/","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Request","time":"2017-06-13T13:36:48.3336865Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"DEBUG /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df49","ai.internal.nodeName":"WC1843"},"data":{"baseType":"RequestData","baseData":{"ver":2,"id":"|WC1843-a3501fd0-ac63df49.","name":"DEBUG /","duration":"00:00:00.1564017","success":true,"responseCode":"200","url":"http://localhost:62731/","properties":{"httpMethod":"DEBUG","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.5106855Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"AuthenticationScheme: Cookies was not authenticated.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler","AuthenticationScheme":"Cookies","{OriginalFormat}":"AuthenticationScheme: {AuthenticationScheme} was not authenticated.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.6199493Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET /","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Request successfully matched the route with name 'default' and template '{controller=Home}/{action=Index}/{id?}'.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Routing.RouteBase","{OriginalFormat}":"Request successfully matched the route with name '{RouteName}' and template '{RouteTemplate}'.","RouteName":"default","DeveloperMode":"true","AspNetCoreEnvironment":"Development","RouteTemplate":"{controller=Home}/{action=Index}/{id?}"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.7240547Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executing action Iceberg.Controllers.HomeController.Index (Iceberg)","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","{OriginalFormat}":"Executing action {ActionName}","DeveloperMode":"true","AspNetCoreEnvironment":"Development","ActionName":"Iceberg.Controllers.HomeController.Index (Iceberg)"}}}}
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executing action method Iceberg.Controllers.HomeController.Index (Iceberg) with arguments ((null)) - ModelState is Valid
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.7732242Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executing action method Iceberg.Controllers.HomeController.Index (Iceberg) with arguments ((null)) - ModelState is Valid","severityLevel":"Information","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","ValidationState":"Valid","{OriginalFormat}":"Executing action method {ActionName} with arguments ({Arguments}) - ModelState is {ValidationState}","DeveloperMode":"true","AspNetCoreEnvironment":"Development","ActionName":"Iceberg.Controllers.HomeController.Index (Iceberg)"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:48.7771150Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executed action method Iceberg.Controllers.HomeController.Index (Iceberg), returned result Microsoft.AspNetCore.Mvc.ViewResult.","severityLevel":"Verbose","properties":{"ActionResult":"Microsoft.AspNetCore.Mvc.ViewResult","CategoryName":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","{OriginalFormat}":"Executed action method {ActionName}, returned result {ActionResult}.","DeveloperMode":"true","AspNetCoreEnvironment":"Development","ActionName":"Iceberg.Controllers.HomeController.Index (Iceberg)"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:49.6276940Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Compilation of the generated code for the Razor file at 'C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Home\\PublicIndex.cshtml' started.","severityLevel":"Verbose","properties":{"FilePath":"C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Home\\PublicIndex.cshtml","CategoryName":"Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService","{OriginalFormat}":"Compilation of the generated code for the Razor file at '{FilePath}' started.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:50.8462465Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Compilation of the generated code for the Razor file at 'C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Home\\PublicIndex.cshtml' completed in 1212.6438ms.","severityLevel":"Verbose","properties":{"FilePath":"C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Home\\PublicIndex.cshtml","CategoryName":"Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService","ElapsedMilliseconds":"1212.6438","{OriginalFormat}":"Compilation of the generated code for the Razor file at '{FilePath}' completed in {ElapsedMilliseconds}ms.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:50.9127370Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Compilation of the generated code for the Razor file at 'C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\_ViewStart.cshtml' started.","severityLevel":"Verbose","properties":{"FilePath":"C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\_ViewStart.cshtml","CategoryName":"Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService","{OriginalFormat}":"Compilation of the generated code for the Razor file at '{FilePath}' started.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:50.9679478Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Compilation of the generated code for the Razor file at 'C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\_ViewStart.cshtml' completed in 52.5297ms.","severityLevel":"Verbose","properties":{"FilePath":"C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\_ViewStart.cshtml","CategoryName":"Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService","ElapsedMilliseconds":"52.5297","{OriginalFormat}":"Compilation of the generated code for the Razor file at '{FilePath}' completed in {ElapsedMilliseconds}ms.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:50.9763616Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"The view '/Views/Home/PublicIndex.cshtml' was found.","severityLevel":"Verbose","properties":{"ViewName":"/Views/Home/PublicIndex.cshtml","CategoryName":"Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor","{OriginalFormat}":"The view '{ViewName}' was found.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor:Information: Executing ViewResult, running view at path /Views/Home/PublicIndex.cshtml.
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:50.9830038Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executing ViewResult, running view at path /Views/Home/PublicIndex.cshtml.","severityLevel":"Information","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor","{OriginalFormat}":"Executing ViewResult, running view at path {Path}.","Path":"/Views/Home/PublicIndex.cshtml","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.0334094Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"View lookup cache miss for view '_Layout' in controller 'Home'.","severityLevel":"Verbose","properties":{"ControllerName":"Home","ViewName":"_Layout","CategoryName":"Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine","{OriginalFormat}":"View lookup cache miss for view '{ViewName}' in controller '{ControllerName}'.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.1260378Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Compilation of the generated code for the Razor file at 'C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Shared\\_Layout.cshtml' started.","severityLevel":"Verbose","properties":{"FilePath":"C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Shared\\_Layout.cshtml","CategoryName":"Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService","{OriginalFormat}":"Compilation of the generated code for the Razor file at '{FilePath}' started.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.2825633Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Compilation of the generated code for the Razor file at 'C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Shared\\_Layout.cshtml' completed in 154.0786ms.","severityLevel":"Verbose","properties":{"FilePath":"C:\\Users\\jpiquette\\Source\\Iceberg\\Views\\Shared\\_Layout.cshtml","CategoryName":"Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRoslynCompilationService","ElapsedMilliseconds":"154.0786","{OriginalFormat}":"Compilation of the generated code for the Razor file at '{FilePath}' completed in {ElapsedMilliseconds}ms.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.3027823Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Tag helper component 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent' initialized.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper","ComponentName":"Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent","{OriginalFormat}":"Tag helper component '{ComponentName}' initialized.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.3074495Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Tag helper component 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent' processed.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper","ComponentName":"Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent","{OriginalFormat}":"Tag helper component '{ComponentName}' processed.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.3281429Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Tag helper component 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent' initialized.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper","ComponentName":"Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent","{OriginalFormat}":"Tag helper component '{ComponentName}' initialized.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.3305192Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Tag helper component 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent' processed.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper","ComponentName":"Microsoft.AspNetCore.ApplicationInsights.HostingStartup.JavaScriptSnippetTagHelperComponent","{OriginalFormat}":"Tag helper component '{ComponentName}' processed.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Information: Executed action Iceberg.Controllers.HomeController.Index (Iceberg) in 2641.6233ms
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.3708883Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Executed action Iceberg.Controllers.HomeController.Index (Iceberg) in 2641.6233ms","severityLevel":"Information","properties":{"CategoryName":"Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker","ElapsedMilliseconds":"2641.6233","{OriginalFormat}":"Executed action {ActionName} in {ElapsedMilliseconds}ms","DeveloperMode":"true","AspNetCoreEnvironment":"Development","ActionName":"Iceberg.Controllers.HomeController.Index (Iceberg)"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.3761765Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAFA\" completed keep alive response.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel","ConnectionId":"0HL5IC4UQLAFA","{OriginalFormat}":"Connection id \"{ConnectionId}\" completed keep alive response.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 3042.2608ms 200 text/html; charset=utf-8
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:36:51.3822633Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.operation.parentId":"|WC1843-a3501fd0-ac63df48.","ai.internal.nodeName":"WC1843"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Request finished in 3042.2608ms 200 text/html; charset=utf-8","severityLevel":"Information","properties":{"CategoryName":"Microsoft.AspNetCore.Hosting.Internal.WebHost","StatusCode":"200","ElapsedMilliseconds":"3042.2608","DeveloperMode":"true","AspNetCoreEnvironment":"Development","ContentType":"text/html; charset=utf-8"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Request","time":"2017-06-13T13:36:48.3336865Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.location.ip":"127.0.0.1","ai.application.ver":"1.0.0.0","ai.operation.name":"GET Home/Index","ai.cloud.roleInstance":"WC1843","ai.operation.id":"WC1843-a3501fd0-ac63df48","ai.internal.nodeName":"WC1843"},"data":{"baseType":"RequestData","baseData":{"ver":2,"id":"|WC1843-a3501fd0-ac63df48.","name":"GET Home/Index","duration":"00:00:03.0633276","success":true,"responseCode":"200","url":"http://localhost:62731/","properties":{"httpMethod":"GET","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:38:38.2082350Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.application.ver":"1.0.0.0"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAF9\" received FIN.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv","ConnectionId":"0HL5IC4UQLAF9","{OriginalFormat}":"Connection id \"{ConnectionId}\" received FIN.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:38:38.2082350Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.application.ver":"1.0.0.0"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAFA\" received FIN.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv","ConnectionId":"0HL5IC4UQLAFA","{OriginalFormat}":"Connection id \"{ConnectionId}\" received FIN.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:38:38.2340466Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.application.ver":"1.0.0.0"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAFA\" disconnecting.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel","ConnectionId":"0HL5IC4UQLAFA","{OriginalFormat}":"Connection id \"{ConnectionId}\" disconnecting.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:38:38.2340466Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.application.ver":"1.0.0.0"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAF9\" disconnecting.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel","ConnectionId":"0HL5IC4UQLAF9","{OriginalFormat}":"Connection id \"{ConnectionId}\" disconnecting.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:38:38.2599763Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.application.ver":"1.0.0.0"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAFA\" stopped.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel","ConnectionId":"0HL5IC4UQLAFA","{OriginalFormat}":"Connection id \"{ConnectionId}\" stopped.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-06-13T13:38:38.2599763Z","tags":{"ai.internal.sdkVersion":"aspnet5c:2.1.0-beta3","ai.application.ver":"1.0.0.0"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"Connection id \"0HL5IC4UQLAF9\" stopped.","severityLevel":"Verbose","properties":{"CategoryName":"Microsoft.AspNetCore.Server.Kestrel","ConnectionId":"0HL5IC4UQLAF9","{OriginalFormat}":"Connection id \"{ConnectionId}\" stopped.","DeveloperMode":"true","AspNetCoreEnvironment":"Development"}}}}

I concur, it actually hangs my VS whenever I try to debug EF stuff (which logs a ton of stuff).

Same issue here, Doing some memory profiling to make sure I have no leaks, and noticing a lot of stuff being added to an application insights ConcurrentDictionary+Node<String, String>

As far as I knew, I had no insights running at all (no NuGet package added)

Just like Trcx528 I see output into my debug console along the lines of:
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Message","time":"2017-07-26T22:02:13.2372631Z","tags":{"ai.operation.id":"95b3c749-......

How do we disable it?

Same issue, doing anything is taking forever...

ApplicationInsights is being dynamically injected. One way to disable this is to set the environment variable ASPNETCORE_preventHostingStartup to "true" in your project launch settings.

See https://github.com/aspnet/Hosting/commit/8377d226f1e6e1a97dabdb6769a845eeccc829ed

@Tratcher can you give more details? From the linked commit, I can't figure out how to modify my launchSettings.json file.

Any reason why these are on by default? Are you collecting usage information?

Visual Studio 2017 has the "Developer Analytics Tools" extension installed as a strong dependency of asp.net - when you try to uninstall, it will uninstall your web development and dotnet core tools, too (omg). I disabled this extension - no effect, the annyoing debug messages appear by default (arg).

The Microsoft.AspNetCore.All meta nuget package has a dependency on application insights package, so it is installed by default (arg). If you publish your app using a specific RID, the application insights dlls are copied, too.

The complicated, undocumented way of opt-out is correctly given by @Tratcher: in VS, on your web project open Properties > launchSettings.json, find the profile you want to change, and change the environmentVariables. An example from my project looks like this:

      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_preventHostingStartup": "True"
      },

Alternatively, you can right click your web project > Properties > Debug and add the mystic environment variable there. Grrr. This should be opt-in or simple opt-out!

Thanks! I discovered this only because of the unconfigured logger.

Can someone from MS please confirm if @nzain's workaround disables Application Insights, or just hides the logs?

I don't want AI at all.

I don't want AI at all.

+1

I don't want AI at all.

+1

@Trcx528 Please consider changing the title to

"How to remove Application Insights in ASP.NET Core 2.0 ~preview~"

...so it gets more attention? This problem is still with us. If it has "preview" in the title it might get ignored because the final version was recently released.

And thanks for your post, and for alerting all of us.

I don't want AI at all.
+1

I concur, this is really odd behaviour.

I know it's nice that you are able to just "enable" Application Insights through Azure without having to even reference it in your project, but I think the cost is too high from a framework perspective, if this is how it is done.

We're going to add some ui to disable AI injection when running in VS. We should have added it in the first place (it was an oversight).

The workaround that @Tratcher suggested works fine but will disable the light up feature completely so it can affect more than insights. For example, the ASP.NET Core IIS Module lights up the IISIntegration package when it launches the process https://github.com/aspnet/AspNetCoreModule/blob/002c8b9bc9a86cd3b4308e62c1f70ea625cbaae2/src/AspNetCore/Inc/serverprocess.h#L18.

Thanks @davidfowl. I'm going to leave the workaround in place for now, but it would be really great if once this new UI is added into VS, the release notes warns us who are using this environment variable that we should probably unset it to avoid the potential light up issues, and use the new UI feature. Thanks again!

@davidfowl Thanks for letting us know this will soon be opt-in rather than opt-out! However, you mentioned that there will be a UI for this - I'm not sure I udnerstand what you mean, but consider that many of us don't run from VS, so it should be possible to disable without having VS / a UI.

Also, please let us know whether @nzain's workaround disables Application Insights, or just hides the logs?

@grokky1 What exactly are you talking about? It's not on by default. Visual studio sets an environment variable to light the feature up. That's how the system works...

@davidfowl If it's not on by default then why did many of us find it in our logs? That's how we found this thread to begin with...

But you're right I'm not sure how it works, I just want comfort I don't have it running unless I opt-in.

@davidfowl If it's not on by default then why did many of us find it in our logs? That's how we found this thread to begin with...

What logs? In Visual studio or elsewhere?

But you're right I'm not sure how it works, I just want comfort I don't have it running unless I opt-in.

No problem, that's what I'm here for 😝 .

@davidfowl For example the debug log as shown above by @Trcx528 and @simonmurdock (which is also how I discovered this). So we wanted to know whether for now, until the changes you mentioned, @nzain's workaround disables it completely or just hides those logs.

@davidfowl For example the debug log as shown above by @Trcx528 and @simonmurdock. So we wanted to know whether for now, until the changes you mentioned, @nzain's workaround disabled it completely or just hides those logs.

Visual studio output, like I mentioned before. That doesn't just happen when you run any ASP.NET Core application.

@davidfowl Aaah now I see what you mean. 😄 I was worried it was a runtime thing too. Thanks for the confirmation. Also looking forward to optin/out changes in VS as you mentioned.

Hi @davidfowl - I'm running VS15.4.0 (Preview 1) and App Insights is definitely being collected and attached to a ASP.NET Core app by default? It's not being sent anywhere but it's there.

Hi @davidfowl - I'm running VS15.4.0 (Preview 1) and App Insights is definitely being collected and attached to a ASP.NET Core app by default? It's not being sent anywhere but it's there.

That's correct, it lights up in Visual Studio by default and there's no off switch. You can turn off all light up but that's a big hammer. Still, it's a workaround for now.

Previously we had the option in Program.cs to include (or not) AI, any reason why we couldn't have something similar going forward?

Previously we had the option in Program.cs to include (or not) AI, any reason why we couldn't have something similar going forward?

The goal of this feature is to enable lighting up AI for diagnostics externally. Things are in place such that it isn't on by default, but various external actions may turn it on without having to touch application code (which is brittle).

The problem is that the Visual Studio experience turns it on (only during debugging I believe) by default and doesn't give an option to disable it.

@davidfowl Now that you've explained it, I feel at ease, especially as you've confirmed we'll soon be able to control it.

But put yourself in our shoes. Most of us don't know what AI is, don't need it, and won't ever use it (I admit I too don't fully understand it!). But we know it has something to do with "telemetry", which is such a poisonous word that the Azure team smartly chose the word "insights" instead.

My boss doesn't care if it can be disabled/enabled, or whether it's off by default and VS currently intentionally/unintentionally (or due to a bug/oversight) turns it on. All he cared is that we have a potential leak in our IP, which ends up who knows where... And who could blame him. We had major drama.

It's the same problem as with EF Core, before they added that environment variable to disable CLI telemetry.

The problem is that the docs are always behind the code. So whenever there's telemetry, the docs should explain it to us - keep in mind we don't understand the framework like you do. So when the VS team discovered this issue, they should have come clean and documented it. I know docs aren't your field (your field is "producing the awesome" :smile:), but please put pressure on the docs team. If I knew what this feature was and could explain it to my team and my manager, there would have been less "drama". Finding out about it afterwards would make anyone jump to evil conclusions, I hope you see that... For your team it's no biggie (and you may think we're being overly dramatic over nothing), but for your users and their managers, this sort of thing is a major biggie.

(So we're clear, the stuff your ASP team does is 101% awesome... And thanks for always taking time to help.)

I was going to write something similar... Putting my Agile Product Owner hat on, shouldn't this feature be there if requested and work how users need it to work not what MSFT thinks it should do?

I've always felt this is the bit of Agile/Lean that MSFT has yet to grasp, working in Sprints and regular releases with tons of new products and features is great but who is asking for them and where is the feedback loop?

@grokky1 What exactly are you talking about? It's not on by default. Visual studio sets an environment variable to light the feature up. That's how the system works...

When your reference the AspNetCore.All nuget package, it includes application insights. When you run VS, it is on by default, which is terrible (my oppinion). If I want AI (from a developer/product owner) perspective, I would opt-in (via nuget package for example). This may well be complex trickery where only the dll is published, but does nothing by default until azure does stuff to enable it. Not the way, I would work with telemetry, but I see your point with "not to change code to enable/disable telemetry". I don't agree, but I get the idea.

Did you know that there are people without IIS? Without lights on anything? Without azure? Without microsoft telemetry? Without IIS? I know, this is terribly difficult to imagine, but I say Linux, nginx, kestrel and my own controlled telemetry. Works like a charm except for AI is bugging me.

This is nothing like telemetry but thanks for the feedback. We'all address the specific concern the way I described

I wanted to make some statements here to hopefully clarify and ease some peoples fears.

  1. When debugging in Visual Studio Application Insights is used as a mechanism to provide you with more information about your debug session. For example, it adds the exceptions that occurred in the last debug session to code lens. Like this: https://twitter.com/condrong/status/897227862733869057

    • It is not, in any way, sending data to anywhere. Unless you decide you go out of your way to configure your local machine to send data to some remote app insights. But even then it would be your own App Insights instance for your own reasons.
  2. When using Azure App Services, there is a mechanism where you can choose to Add Application Insights to your application. When you do this you create your own Application Insights resource and we can auto-configure app so that logs and such automatically go there without you re-deploying your app. This is so that people can hit a problem in Azure and turn on Application Insights if they think it will get them the data they want. For example, App Insights makes it really easy to see failed requests to a web site and helps you diagnose why they failed. There are a number of case studies we have that have used Application Insights to diagnose production issues. The problem being solved is having to change code and re-deploy. We, being Microsoft not so much me personally, spend a lot of time helping people be successful deploying their apps to Azure. One of the best ways we have to diagnose and solve production issues right now is by getting all the data we can into Application Insights where it can be examined, disected, monitored, etc. This feature is all about making that painless and seamless. The problem is that people don't generally know they need this until they do, and then asking them to re-deploy to turn it on is painful and annoying.

  3. The inside VS experience happens to use the same lightup technique that the App Service thing uses, but they are very different use cases.

Does that help with some of the confusion around this?

Does that help with some of the confusion around this?

Thanks for the info. Personally code lens is another feature that I dislike and disable. Intellitrace is another. The new-ish feature in 2017 that shows visual perf and timings is another one I disable. In short, there's a lot of junk running by default that bogs down VS, and VS doesn't need any help with being slow. This isn't so much a complaint, as is it's feedback that in my experience I don't find many of the VS features to be useful. But I'm sure you know that already, as you guys collect that info. I'm probably in the minority since I spend time to seek that stuff out and disable it. But think of the thousands of folks that have no clue that they can do that. Hell, F5 is slow enough -- not enough of Ctrl-F5 is used (and for those that don't know, Ctrl-F5 launches the app without debugging and it's tons faster). I know I sound crazy and you're probably rolling your eyes, but those wasted cycles add up.

In short, my personal feedback is more junk does not equate to being good.

Specifically for app insights, perhaps the issue is that it's known to be an azure-specific product. ASP.NET is positioned as a "open" framework, so sneaking azure products into the framework feels dirty and leads to distrust in Microsoft. I don't care if it's almost a nop, I'd prefer to not have superfluous (and especially unwanted product-ized) code in there.

For those that want it, awesome. For my customers that use it, they love it. So great job on making (or buying?) a great and useful feature. Just make it opt-in, please.

...issue is that it's known to be an azure-specific product. ASP.NET is positioned as a "open" framework, so _SNEAKING_ azure products into the framework feels dirty and leads to distrust in Microsoft. I don't care if it's almost a nop...

+1

I published my project and even when I include ASPNETCORE_preventHostingStartup in the environment variables, it still lists Microsoft.ApplicationInsights as dependency... So seems the workaround only works for debugging but not publishing, right? Or have I missed something?

The dependency is always there but it does nothing unless somebody lights it up.

The problem, is that I only have the runtime installed on the server and therefore get an assembly specified in the dependencies manifest was not found message. For now, I installed the SDK and the problem disappeared, but that's not a clean solution.

I'm not sure how the 2 things are connected. Can you provide an end to end sample with repro steps and the full error message.

Just create a new ASP.NET Core 2.0 Web-Application using the empty template. You get a minimal csproj like this:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
  </ItemGroup>

</Project>

Now publish the project to a directory and look into the generated .deps.json file. Microsoft.ApplicationInsights will be included in it, no matter what I include in the launchSettings.

Yes and it works. Like I said earlier the dependency is always included, and it does nothing until something lights it up.

Not correct. Does not work, when the runtime does not have the dll (runtime
store). This is the case for linux-arm RID, to name one example. As others
have said, it fails with dll not found error.

Am 10.09.2017 10:38 schrieb "David Fowler" notifications@github.com:

Yes and it works. Like I said earlier the dependency is always included,
and it does nothing until something lights it up.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/Home/issues/2051#issuecomment-328328232, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ANUK-3BK2phWmuA45xY__m7nq1cbya0Tks5sg6AQgaJpZM4N0O32
.

I tried it on Ubuntu 16.04 and it showed a error message that the DLL is missing in the store. So it's definetly not working. I can't copy the message since I already have the SDK installed right now, but it should be pretty easy to reproduce.

If you can provide specific repro steps or even a project with repro steps that would be great! Don't forget to specify all of the environment details (dotnet --info works well for that).

The expectation is that everything works by default (which is what we've verified). If we missed something it would be good to know. This is the first time I've seen a complaint about the "default" experience not working. I can't even reproduce it myself but I'm sure I'm missing some specific detail that was left out.

@davidfowl Exact repro here: https://github.com/dotnet/core-setup/issues/3122
No project needed, the default web template pulls application insights as a dependency. But you need an arm device for exact repro.

The Raspian repository (Raspberry Pi default Linux distro) might have a different story (if you install via apt-get), but I think they have the same problem. Maybe someone else can confirm this - we don't have a raspberry pi and our buildroot distro is not debian.

@Falco20019 has reported that it fails on Ubuntu 16.04, too - on x64 or arm architecture? You said, it worked when you installed the SDK. Maybe you can provide some more details: what did you install before (link)? If it fails on linux-x64 too, this is easier to reproduce for people without an arm device.

I'll wait for more clarification as I'm confused.

The arm issue is because we don't have a runtime store for linux arm (the workaround is also posted in the issue).

@Falco20019 is this the issue you're running into?

I agree that arm is niche, but you should not say it "works by default". It works by default on windows-x64 for sure. I think the "run dotnet anywhere" idea is great, this is the success story of java. Personally, I love dotnet and tricky embedded projects turn into "dotnet core opportunities". The default templates should run anywhere, right?

Yes but it's specifically because we didn't target ARM as a first class scenario. ARM is currently in the "it works if you make changes category". It won't be that way forever but to claim that application insights in the reason for the issue is just incorrect.

I get that this thread is about making app insights opt in instead of opt out and we need to re-evaluate the experience, but I haven't seen any actual proof of it being the problem in anything mentioned. I'm all for helping, I just don't like the spreading of FUD.

davidfowl... this thread is about making app insights opt in instead of opt out

Agreed, we need to focus on that, or we'll get bogged down by too many problems and not solve anything.

(...folks maybe we can discuss the other problems in a new issue?)

@davidfowl Sorry, was sick and only just saw it now. The Server is "Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-71-generic x86_64)" so not ARM.

We have noticed that when using the dotnet runtime package to run the published results of a dotnet publish we get the app insights issue. If we use the dotnet sdk package to run the published results of a dotnet publish it runs fine? This has been an issue inside our docker containers as we are trying to target the runtime only for deployed containers. This was doable with aspnetcore 1.

@AlphaCluster can you provide an explicit set of repro steps? Are you not using the ASP.NET container base image and instead using the dotnet base image? That base image does not have the runtime store but you should get an error explaining that, not an app insights load failure.

We are building our own image using the dotnet runtime and sdk tarballs being released. We are publishing to a folder using dotnet publish which we then run inside the container which is running the runtime. This worked fine for us with the 1.0 version but after 2.0 came out when we migrate we get this issue if we use the runtime container.

Error:
  An assembly specified in the application dependencies manifest (<project name>.deps.json) was not found:
    package: 'Microsoft.ApplicationInsights.AspNetCore', version: '2.1.1'
    path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll'
  This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
    aspnetcore-store-2.0.0-linux-x64.xml;aspnetcore-store-2.0.0-osx-x64.xml;aspnetcore-store-2.0.0-win7-x64.xml;aspnetcore-store-2.0.0-win7-x86.xml

This issue looked similar to what we were seeing so if this is a different issue I can open a different issue.

@AlphaCluster can you file a new issue with the specific repro steps you used to make the custom docker container? That will help us reproduce the issue without ambiguity.

In 2.0.0 we added the runtime store which is required to run any application with trimmed published output (which is the default behaviour). Unfortunately the sdk and runtime tarballs do not include the runtime store so you'll need to install that in your docker container. There's an example image that illustrate how to install the new runtime store at https://github.com/aspnet/aspnet-docker/blob/master/2.0/jessie/runtime/Dockerfile#L5.

@AlphaCluster : We decided to not use the Microsoft.AspNetCore.All NuGet package because it brought the ApplicationInsights dlls into our publish folder and instead we specify the NuGet packages explicitly.

I removed the ton of telemetry logging of Application Insights by using this in Configure method of Startup class :

var configuration = app.ApplicationServices.GetService<TelemetryConfiguration>();
configuration.DisableTelemetry = true;            

Thanks Ysris - this worked for me. Too bad you have to get clear to the end of this article to find it.

@tpplyler You're welcome.
Please note that, under vscode, this patch will throw an exception that should be trycatched.

@ysris's solution worked for me as well.

So it looks like setting TelemetryConfiguration.DisableTelemetry = true in Startup.Configure() is about the simplest way to "reverse" the "lighting up" of AI that Visual Studio does by default. The AI assemblies will still be included as NuGet dependencies, especially if using the Microsoft.AspNetCore.All package, but they won't do anything. The only way they would do anything is if lit up again by some other means, e.g. in Azure. Setting ASPNETCORE_preventHostStartup to true achieves the same effect, as first suggested by @Tratcher back in July, but according to the docs, it also

Prevents the automatic loading of hosting startup assemblies, including the app's assembly.

This is quite a "big hammer", as @davidfowl conceded in September, and probably has undesired side effects, so I'm sticking with @ysris's solution.

Unfortunately for me, @ysris' solution didn't work. I had to use the "big hammer" solution provided fy @Tratcher. See https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/724

This is very disturbing, as the brutal injection by VS of AI in the process being debugged creates a situation that has side effects and hampers the debugging experience. I have to agree with @brockallen that I'd rather have a stable and sound VS without all this fluff that I'm not using (and that cost me almost two days of work now).

Big thumbs down to implicit opt-ins.

I am closing this issue as it has now reached the point were there are several different bugs all being talked about at the same time and none of them are best reported here.

To summarize some of the things we said that I am not sure were made clear enough:

  • App Insights happens to be the first assembly listed when you have a problem with the runtime store, which means it appears in many error messages that actually have nothing to do with application insights. If we didn't depend on app insights it would some other ASP.NET Core assembly that was appearing there at the same time.
  • One of the side effects you can get if you have problems with the runtime store is that assemblies can appear in your bin, like application insights. The default experience if all you depend on is the AspNetCore.All metapackage is that only your app assembly should be in the bin. If that isn't the case you are hitting a bug completely independent of App Insights.
  • We are adding more obvious options to not turn on app insights when debugging in VS. They will appear in a future update. There is also more fine-grained control to exclude specific hosting startup assemblies without turning hosting startup off in general.

Bugs about the App Insights not working as expected should go in the app insights repo, bugs about runtime store problems can be filed in the meta-packages repo, or just another issue here in the home repo with clear repro steps and we can help you work out what the problem is.

There is like a circular reference, both projects references each other to justify a close status?
Cf. https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/523 which is expecting this project to fix the issue.
Can we re-open this one? Or the other?

@DenisDollfus I think this thread provides enough explanation/work-arounds to be considered closed

@Rabadash8820 A fix would be better than workarounds. But actually I missed @glennc last point above stating that "We are adding more obvious options to not turn on app insights when debugging in VS. They will appear in a future update.", which is great.
Having an open issue to track the availability of this update would be helpful.

We don't track tooling issues on here.

This is VERY frustrating. With DotNet Core 2.0, ApplicationInsights is being forced on us which is exactly the OPPOSITE of open source.

@genifycom - btw this is fixed in the latest previews of Visual Studio. There is now a tools option to turn it off.

image

@BillHiebert That looks perfect, thanks for sharing.
I don't see it in VS 2017 15.5.5. Is it part of preview 15.6?

EDIT: Oh yes you wrote "preview". Anyway not deleting my mistake as it provides version number for anyone looking for the fix.

@DenisDollfus - correct. The change is in a preview of 15.6

this has been released in the latest version of Visual Studio 15.6.3.

Even with the checked options and setting up: "ASPNETCORE_preventHostingStartup": "True"
I still see some telemetry logs while debugging

image

Any ideas?? I wish to fully remove these logs.

Upgrade to ASP.NET Core 2.1 😄

How to remove the dependency from an existing project?
I create a template project from web api .net core and if I try to run in a different computer from the build I'm getting this error:
image

@afucher Assuming you are targeting netcoreapp2.0, it looks like you have not installed the 2.0 aspnetcore runtime store. The runtime store is included with the sdk: https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.200 or you can download the ASP.NET Core Runtime individually at https://www.microsoft.com/net/download/dotnet-core/runtime-2.0.8.

@davidfowl upgrading didn't fix it for me.

  1. Local App Insights is disabled in VS (15.7.3)
  2. Running ASP.NET Core 2.1

My output is still flooded with AI logs.

Checking "Disable local Application Insights ..." in Tools -> Options worked for me. VS 15.7.5.

I'm on 15.8.4; "Tools > Options > Projects & Solutions > Web Projects > Disable local Application Insights..." is checked; launchSettings.json has "ASPNETCORE_preventHostingStartup": "True". I still see Application Insights in the Output...

@RodBarnes same here

I pulled the plug by doing:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
#if !DEBUG
        .UseApplicationInsights()
#endif
        .UseStartup<Startup>();

in Program.cs

Ok, so I finally got the debug stream silenced on ASP.NET Core 2.1;

if (_env.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
    TelemetryConfiguration.Active.DisableTelemetry = true;
    TelemetryDebugWriter.IsTracingDisabled = true;
}

Note the IsTracingDisabled was the key, but I left in DisableTelemetry for good measure plus it's helpful when searching for references between .NET Framework & .NET Core projects in the same solution.

thanks f2calv, your code work on ASP.NET Core 2.2.

"Disable local Application Insights for Asp.Net Core web projects" doesn't seem to have any effect on AI in VS 15.9.5, nor does setting TelemetryConfiguration.Active.DisableTelemetry nor does setting the environment variable ASPNETCORE_preventHostingStartup (and restarting VS). I can still see the logs in the output.

"Disable local Application Insights for Asp.Net Core web projects" doesn't seem to have any effect on AI in VS 15.9.5, nor does setting TelemetryConfiguration.Active.DisableTelemetry nor does setting the environment variable ASPNETCORE_preventHostingStartup (and restarting VS). I can still see the logs in the output.

Same problem, the Disable local Application Insights for Asp.Net Core web projects does not do anything with VS 15.9.4 & .NET Core SDK version 2.1.502

At the bottom of the thread referenced by @ghosttie was the key for me, official doc here: https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core#disable-telemetry-dynamically

Was this page helpful?
0 / 5 - 0 ratings