gpt4 book ai didi

asp.net-core - 无法解析类型 'Microsoft.ApplicationInsights.TelemetryClient' 的服务

转载 作者:行者123 更新时间:2023-12-02 00:00:03 25 4
gpt4 key购买 nike

我已将 Web 项目从 RC1 迁移到 RC2,但遇到此错误:

Unable to resolve service for type 'Microsoft.ApplicationInsights.TelemetryClient' while attempting to activate 'Microsoft.ApplicationInsights.AspNetCore.ExceptionTrackingMiddleware'.

enter image description here

有什么想法吗?

最佳答案

您需要将 "Microsoft.ApplicationInsights.AspNetCore": "1.0.0-rc2-final" 添加到您的 project.json 并将其添加到您的 启动类:

public void ConfigureServices(IServiceCollection services)
{
...
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
...
}

public void Configure(IApplicationBuilder app)
{
...
app.UseApplicationInsightsRequestTelemetry();
app.UseApplicationInsightsExceptionTelemetry();

...
app.UseMvc();
}

关于asp.net-core - 无法解析类型 'Microsoft.ApplicationInsights.TelemetryClient' 的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37923313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com