Is there a way to disable Application Insights in a ASP.NET Web app? Suppose I want to switch off all data collection in an app running in production.
Asked
Active
Viewed 4,130 times
4
-
any specific reason why you want to turn it off? – John Gardner Nov 14 '15 at 00:18
-
Where you hosted application? – Ramakrishna Nov 17 '15 at 07:25
-
The apps are hosted on premise – mstrand Nov 17 '15 at 08:32
-
Possible duplicate of [Disable application insights in debug](http://stackoverflow.com/questions/32057441/disable-application-insights-in-debug) – Chris McKee Jun 21 '16 at 09:41
1 Answers
4
if the ikey is in the ApplicationInsights.config
file, you can remove it from the config file and it should stop sending data.
if the ikey is somewhere else, you'll have to disable via code:
TelemetryConfiguraiton.Active.DisableTelemetry
worst worst case you could always prevent outbound web requests to dc.services.visualstudio.com
, where AI would be sending the data.

John Gardner
- 24,225
- 5
- 58
- 76
-
Would be nice to have the TelemetryConfiguraiton.Active.DisableTelemetry as an configuration file option – mstrand Nov 17 '15 at 08:34
-
The Configuration method in the Startup.cs class is a good place to put 'TelemetryConfiguration.Active.DisableTelemetry = true;'. Also need to add the 'using Microsoft.ApplicationInsights.Extensibility;' statement to the usings section at the head of the file, too. – Brett Rigby Apr 05 '18 at 07:43