无法解析类型为"Microsoft.ApplicationInsights.TelemetryClient"的服务 [英] Unable to resolve service for type 'Microsoft.ApplicationInsights.TelemetryClient'
问题描述
我已将我的Web项目从RC1迁移到RC2,但是出现此错误:
I have migrate my Web project from RC1 to RC2, but I'm having this error:
无法解析类型的服务尝试执行'Microsoft.ApplicationInsights.TelemetryClient'启用"Microsoft.ApplicationInsights.AspNetCore.ExceptionTrackingMiddleware".
Unable to resolve service for type 'Microsoft.ApplicationInsights.TelemetryClient' while attempting to activate 'Microsoft.ApplicationInsights.AspNetCore.ExceptionTrackingMiddleware'.
有什么想法吗?
推荐答案
您需要在中添加
,并将其保存到您的"Microsoft.ApplicationInsights.AspNetCore":"1.0.0-rc2-final"
project.json Startup
类中:
You need to add "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final"
to your project.json
and this to your Startup
class:
public void ConfigureServices(IServiceCollection services)
{
...
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
...
}
public void Configure(IApplicationBuilder app)
{
...
app.UseApplicationInsightsRequestTelemetry();
app.UseApplicationInsightsExceptionTelemetry();
...
app.UseMvc();
}
这篇关于无法解析类型为"Microsoft.ApplicationInsights.TelemetryClient"的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!