当我厌倦了在没有页面背后代码的 SharePoint 布局 aspx 页面中引用“Microsoft.ApplicationInsights”时,我收到了以下错误。
在编译请求的文件或其依赖项之一期间发生错误。找不到类型或命名空间名称“TelemetryClient”(您是否缺少 using 指令或程序集引用?)
尝试了以下方法
<%@ Assembly Name="Microsoft.ApplicationInsights, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"%>
并且
<%@ Import Namespace="Microsoft.ApplicationInsights" %>
在我试图创建 TelemetryClient 对象以将数据记录到 Azure 的 aspx 页面中的一段内联 C# 代码下方
.....
TelemetryClient telemetryClient = new TelemetryClient();
telemetryClient.InstrumentationKey = instKey;
telemetryClient.TrackException(ex, sp_coid);
.....