小编Val*_*ine的帖子

将Application Insight与ASP API Core一起使用

社区

我在将Application Insights连接到ASP WEB API Core时遇到了麻烦.按照标准手册,我仍无法在AppInsights帐户中找到任何记录.我使用了很多手册,但它们完全相同,并描述了如何为ASP Core(而不是API Core)配置App Insights.所以我想知道是否需要一些特殊配置(或nuget包或其他)来使AppInsights跟踪我的API服务请求?

一旦我无法使AppInsights开箱即用,我仍然可以创建TelemetryClient实例并手动发布数据,但在我的情况下这是不可取的.

重要提示:我正在使用VS 2017 RC,Web APi Core项目(csproj)

UPD

csproj文件内容:

  <Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.0</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
  </PropertyGroup>
  <ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0-msbuild1-update1" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild1-final" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild2-update1" />
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0-msbuild1-update1" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild1-final" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild2-update1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="1.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.0.1" />
    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.2.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="1.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Cors" Version="1.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="1.0.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.0.1" />
    <PackageReference …
Run Code Online (Sandbox Code Playgroud)

asp.net-web-api azure-application-insights asp.net-core

10
推荐指数
1
解决办法
3936
查看次数