簡體   English   中英

Azure WebJob應用程序見解

[英]Azure WebJob Application Insight

我們在azure Web API站點中部署了一些Web作業。 我們相信其中之一存在內存泄漏,但是我們沒有導致它的原因的詳細信息。 因此,我想看看是否可以將nuget包添加到應用程序見解中。 https://github.com/Azure/azure-webjobs-sdk/wiki/Application-Insights-Integration

當我嘗試運行它時,只會出現如下錯誤

在此處輸入圖片說明 我的程序就是這樣

class Program
{
    private static string ConnectionString { get; set; }
    private static readonly JobHostConfiguration _config = new JobHostConfiguration("DefaultEndpointsProtocol=https;AccountName=mcastagstorage;AccountKey=fW/DoBsghvPgEy2/uBTZSxSSvgPoUs/jGRxV59scXmexpfDSPbSGLovjAuoLtGbSIuDBobDHyIfUdHrWWRz5DA==;EndpointSuffix=core.windows.net");

    // Please set the following connection strings in app.config for this WebJob to run:
    // AzureWebJobsDashboard and AzureWebJobsStorage
    static void Main()
    {
        string instrumentationKey = "MyKey";
        if (!string.IsNullOrEmpty(instrumentationKey))
        {
            // Wire up with default filters; Filtering will be explained later.
            _config.LoggerFactory = new LoggerFactory()
                .AddApplicationInsights(instrumentationKey, null)
                .AddConsole();

            _config.Tracing.ConsoleLevel = TraceLevel.Off;
        }

        ConnectionString = ConfigurationManager.ConnectionStrings["ConsistingEntities"].ConnectionString;

        if (_config.IsDevelopment)
        {
            _config.UseDevelopmentSettings();
        }

        var host = new JobHost(_config);
        // The following code ensures that the WebJob will be running continuously
        host.RunAndBlock();
    }
}

LoaderExceptions如下

在此處輸入圖片說明

我也對.net版本感到困惑,我已經習慣了原始的.net,但是現在看到的是.net標准和核心,不確定我應該使用哪個.net。

任何幫助將不勝感激

我測試了您的代碼並重現了您的問題。

看起來您正在使用WebJobs v3。 如果是這樣,Newtonsoft.Json的版本將是10.0.3。

閱讀本文后,這並未表明這是webjob中的錯誤。

我使用以下方法解決此問題,如果您不介意,則可以返回WebJobs v2 beta或將Newtonsoft.Json更新到版本<10.0.3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM