ASP.NET Core/MVC6中的WebTelemetryInitializerBase [英] WebTelemetryInitializerBase in ASP.NET Core / MVC6

查看:61
本文介绍了ASP.NET Core/MVC6中的WebTelemetryInitializerBase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有MVC6兼容版本的WebTelemetryInitializerBase可以与ASP.NET Core(在完整的.NET Framework上一起使用)?

Is there an MVC6 compatible version of WebTelemetryInitializerBase that would work with ASP.NET Core (on the full .NET Framework)?

请参见我的问题在这里,我问如何在自己的计算机中获取HttpContext临时初始化器.不幸的是,我没有指定我使用的是MVC 6,因此没有使用System.Web.HttpContext.

See my question here where I asked how to get HttpContext in my temeletry initializers. Unfortunately I didn't specify that I was using MVC 6 and thus no System.Web.HttpContext.

推荐答案

是的,aspnetcore有此版本.查看 ASP.NET Core应用程序的Microsoft应用程序见解回购.

Yes, there is a version of this for aspnetcore. Check out the Microsoft Application Insights for ASP.NET Core applications repo.

有一个实现可在/src/Microsoft.ApplicationInsights.AspNetCore/TelemetryInitializers/WebUserTelemetryInitializer.cs ,您可以将其用作指南.

There is an implementation of getting the WebUser found in /src/Microsoft.ApplicationInsights.AspNetCore/TelemetryInitializers/WebUserTelemetryInitializer.cs which you can use as a guide.

TelemetryInitializerBase 类是使用

The TelemetryInitializerBase class is the one that consumes the IHttpContextAccessor which is used to get the HttpContext.

从那里您可以获取 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆