我已将我的Web项目从RC1迁移到RC2,但我遇到此错误:
无法解析类型的服务 ' Microsoft.ApplicationInsights.TelemetryClient'在尝试时 启用 ' Microsoft.ApplicationInsights.AspNetCore.ExceptionTrackingMiddleware'
有什么想法吗?
答案 0 :(得分:7)
您需要将"Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final"
添加到project.json
,然后添加到Startup
班级:
public void ConfigureServices(IServiceCollection services)
{
...
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
...
}
public void Configure(IApplicationBuilder app)
{
...
app.UseApplicationInsightsRequestTelemetry();
app.UseApplicationInsightsExceptionTelemetry();
...
app.UseMvc();
}