-
Notifications
You must be signed in to change notification settings - Fork 123
How to turn off application insights #970
Comments
@ghosttie Where do you see application insights turned on by default? Its is not turned on, unless you add it yourself. |
I never chose it, when I created the project it was already there I don't want to remove it completely in case we want it later, I just want to be able to turn it off when I don't need it |
Please share the screenshots on how you created a new project. I am not aware of application insights being installed automatically for a .net core 2.2 project. You can comment out/remove the services.AddApplicationInsightsTelemetry()/builder.UseApplicationInsights() when you don't need application insights. |
Sorry, I guess I was misleading - it's 2.2 now but it was originally 1.0 that's been upgraded through every version, so maybe it was installed by default in the past but isn't anymore. I tried putting the call to IWebHostBuilder.UseApplicationInsights in an
so I figured it must be more complicated... |
The javascriptsnippet is a known issue, fixed in 2.8.0-beta2. Add services.AddWebEncoders(); in ConfigureServices() method of your Startup.cs class, before services.AddApplicationInsightsTelemetry(); |
I've since upgraded to ASP.NET Core 3.0 and I'm using Microsoft.ApplicationInsights.AspNetCore 2.8.0 In Startup.cs
but when I run it in Debug mode (or just comment it out entirely) I still get
I don't understand why it's doing anything at all if I don't call AddApplicationInsightsTelemetry... |
@ghosttie You still have appliction insights in razor pages. If you didn't intent to use application insights, remove it from razor pages as well. |
I also have a compile time time check around this in _ViewImports.cshtml
and one in _Layout.cshtml
is that what you mean? Or somewhere else? |
All usage of Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet. The error indicates Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet is being requested (and failing as not registered). So remove all references to it. |
Ah, apparently compiler directives don't work in CSHTML. Thank you for your help |
OK I'm left with my original problem - I want to be able to turn off Application Insights when in Debug mode but I can't do it. Because compiler directives don't work in CSHTML I can't turn it off that way, and if I wrap the JavaScriptSnippet line in an Is there not a property in Application Insights to turn off collection? I found references to
I read through that bug but it didn't seem to help with my goal. Reading through the documentation I tried this to turn of all collection:
but it's still logging a bunch of Application Insights Telemetry lines |
Not sure which doc you are following. Here's official doc: |
Application Insights is turned on by default. I'm trying to debug a long running process, so I want it to run as fast as possible and it's spending a lot of time logging Application Insights information which I don't need.
I've followed the steps in dotnet/aspnetcore#2051 and #523 and they don't work.
Repro Steps
Actual Behavior
Application Insights is not disabled
Expected Behavior
Application Insights is disabled
Version Info
SDK Version: 2.7.1
.NET Core Version: 2.2
How Application was onboarded with SDK: Visual Studio
OS: Windows 10
Hosting Info: Running From Visual Studio 2019 v16.2.3
The text was updated successfully, but these errors were encountered: