我已将我的Web项目从RC1迁移到RC2,但我遇到此错误: Unable to resolve service for type ‘Microsoft.ApplicationInsights.TelemetryClient’ while attempting to activate ‘Microsoft.ApplicationInsights.AspNetCore.ExceptionTra
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类:public void ConfigureServices(IServiceCollection services)
{
...
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
...
}
public void Configure(IApplicationBuilder app)
{
...
app.UseApplicationInsightsRequestTelemetry();
app.UseApplicationInsightsExceptionTelemetry();
...
app.UseMvc();
}
