如何将应用洞察力遥测(应用洞察)添加到天青网络工作?
发布于 2018-09-22 13:24:13
使用最近发布的ConfigureLogging SDK3.0,您可以在WebJob方法中添加ApplicationInsights
public static async Task Main(string[] args)
{
var builder = new HostBuilder()
.ConfigureWebJobs(b =>
{
b.AddAzureStorageCoreServices().AddAzureStorage();
})
.ConfigureAppConfiguration(b =>
{
// Adding command line as a configuration source
b.AddCommandLine(args);
})
.ConfigureLogging((context, b) =>
{
b.SetMinimumLevel(LogLevel.Debug);
b.AddConsole();
// If this key exists in any config, use it to enable App Insights
string appInsightsKey = context.Configuration["ApplicationInsights:InstrumentationKey"];
if (!string.IsNullOrEmpty(appInsightsKey))
{
b.AddApplicationInsights(o => o.InstrumentationKey = appInsightsKey);
}
});
var host = builder.Build();
using (host)
{
await host.RunAsync();
}
}发布于 2018-09-20 23:58:29
您可以在开发期间将AI添加到Web中,作为Nuget包。
AI .NET核心坚果是这里。包名有点误导(Microsoft.ApplicationInsights.AspNetCore),但它应该适用于所有.Net核心应用程序。
AI .NET核心GitHub页面是这里 (在Wiki中解释了一些定制选项)。
入门指南是论GitHub和learn.microsoft.com。这是一个有点长的指南,所以我希望链接是好的(虽然没有完全按照这样的指导方针),我不需要张贴作为答复的一部分。
https://stackoverflow.com/questions/52424215
复制相似问题