2

I created an ASP.NET Core project using the templates in Visual Studio 2015, and checked the "Add Application Insights to project" checkbox by mistake.

Later, I removed the Microsoft.ApplicationInsights.AspNetCore package from my project.json, and removed all the references to those classes in Startup.cs.

The project compiles fine, but throws an error when I try to run it in IIS Express:

No service for type 'Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration' has been registered.

Or

The name 'TelemetryConfiguration' does not exist in the current context

Nate Barbettini
  • 51,256
  • 26
  • 134
  • 147

1 Answers1

5

If there are still references to Application Insights in your Razor pages, the application will compile but will not run. (Since Razor pages are compiled at runtime.)

Look for lines referencing Application Insights in Views/_ViewImports.cshtml and Views/Shared/_Layout.cshtml. Once I removed those, my application started up just fine.

Nate Barbettini
  • 51,256
  • 26
  • 134
  • 147