ASP.NET Core MVC application insights stopped working after upgrade to .NET Core 1.1.1

我只是一个虾纸丫 提交于 2019-12-05 03:19:16

There are breaking changes from ApplicationInsights 1.x to 2.x which are documented on GitHub release notes.

  • This release contains a rewrite of the SDK internals for better .NET Core integration and initialization.
  • UseApplicationInsightsRequestTelemetry is obsolete, the logic it used to perform is handled automatically now and calls to this method should be deleted from Startup.cs.
  • UseApplicationInsightsExceptionTelemetry is obsolete, exception telemetry is handled automatically internally now. You should delete calls to this method from Startup.cs otherwise you will get duplicate exception telemetry reported.
  • The MVC dependency for the JavaScript snippet has been removed so in order to include the JavaScript snippet now you need to make the following changes:
    • In _ViewImports.cshtml replace @inject Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration TelemetryConfiguration with @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
    • In _Layout.cshtml replace @Html.ApplicationInsightsJavaScript(TelemetryConfiguration) with @Html.Raw(JavaScriptSnippet.FullScript)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!