我有一个.net 6 web应用程序,我试图找到如何让JS异常显示在控制台中以登录应用程序洞察。
我试着去找,但努力得到任何可以帮助。
我已经成功地能够发送我的nlog,sql,在AI中捕获,但无法获得相同的JS异常。
请让我知道,如果任何额外的细节,从我的结束是必需的。
CSProj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Content Remove="bundleconfig.json" />
</ItemGroup>
<ItemGroup>
<None Include="bundleconfig.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.34" />
<PackageReference Include="Hangfire.SqlServer" Version="1.7.34" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.NLogTarget" Version="2.21.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.16" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.6.3" />
<PackageReference Include="Microsoft.Identity.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.Identity.Web" Version="2.7.0" />
<PackageReference Include="Microsoft.Identity.Web.DownstreamApi" Version="2.9.0" />
<PackageReference Include="Microsoft.Identity.Web.UI" Version="2.7.0" />
<PackageReference Include="NLog" Version="5.2.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.0" />
<PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2022.3.1109" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.16" />
</ItemGroup>
<ItemGroup>
<Compile Include="" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="" />
<ProjectReference Include="" />
</ItemGroup>
<ItemGroup>
<Folder Include="Content\kendo\2022\" />
<Folder Include="Scripts\Bootstrap\" />
<Folder Include="Scripts\kendo\2022\" />
<Folder Include="wwwroot\lib\pages\" />
</ItemGroup>
</Project>
设置
services.AddApplicationInsightsTelemetry();
services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => module.EnableSqlCommandTextInstrumentation = true);
正常AI设置后,我仍然在控制台
中看到一个错误
1条答案
按热度按时间tp5buhyn1#
要跟踪
Application Insights
中的JS异常,请在head标记中添加Layout.cshtml
中的以下JS。我从这个MSDoc中引用并添加了JS。
输出:
“无法初始化AppInsights JS SDK:无法加载Application Insights SDK,
.csproj
).将所有软件包更新到最新版本。