加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core – 无法解析“Microsoft.ApplicationInsights.Tele

发布时间:2020-12-16 09:12:57 所属栏目:asp.Net 来源:网络整理
导读:我已将我的Web项目从RC1迁移到RC2,但我遇到此错误: Unable to resolve service for type ‘Microsoft.ApplicationInsights.TelemetryClient’ while attempting to activate ‘Microsoft.ApplicationInsights.AspNetCore.ExceptionTrackingMiddleware’. 有
我已将我的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,并将其添加到您的Startup类:

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

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

        ...
        app.UseMvc();
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读