簡體   English   中英

無法啟動Azure輔助角色,異常代碼0xe0434352和0xC0000035

[英]Unable to start Azure Worker Role, exception code 0xe0434352 & 0xC0000035

在模擬器中本地運行時,Web worker工作正常。 但是,每當我更新在Azure VM上運行的Web工作器時,我在事件查看器中都會遇到以下異常異常,並且角色將無法啟動:

應用程序:WaWorkerHost.exe
框架版本:v4.0.30319
描述:由於未處理的異常,進程終止。
異常信息:System.AggregateException
Stack:System.Threading.Tasks.Task.Wait()上的System.Threading.Tasks.Task.Wait(Int32,System.Threading.CancellationToken)
在Foo.PushProcess.WorkerRole.Run()
在Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()at System.Threading.ExecutionContext.RunInternal的Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__2()(System.Threading.ExecutionContext,System.Threading.ContextCallback,System .Object,Boolean)
在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,Boolean)
在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)
在System.Threading.ThreadHelper.ThreadStart()

內部異常:任務被取消。

錯誤應用程序名稱:WaWorkerHost.exe,版本:2.6.1198.712,時間戳:0x54eba731
錯誤模塊名稱:KERNELBASE.dll,版本:6.3.9600.17415,時間戳:0x54505737
異常代碼:0xe0434352
故障偏移:0x0000000000008b9c
錯誤進程id:0xfb8
故障應用程序啟動時間:0x01d11e3128981a5d
錯誤的應用程序路徑:E:\\ base \\ x64 \\ WaWorkerHost.exe
錯誤模塊路徑:D:\\ Windows \\ system32 \\ KERNELBASE.dll
報告編號:30631c5c-8a25-11e5-80c6-000d3a22f3ec
錯誤包全名:
錯誤包相關的應用程序ID:

會話“MA_ETWSESSION_WAD_415df88f8a0447178dbd4c18f1349f0e_Foo.PushProcess_Foo.PushProcess_IN_0”無法啟動,出現以下錯誤:0xC0000035

這是相關代碼:

public override void Run()
{
    Trace.TraceInformation("Foo.PushProcess is running");

    try
    {
        RunAsync(_cancellationTokenSource.Token).Wait(); // This is where the exceptions point to
    }
    catch (Exception ex)
    {
        Trace.TraceError("[WORKER] Run error: " + ex);
    }
    finally
    {
        _runCompleteEvent.Set();
    }
}

public override bool OnStart()
{
    // Set the maximum number of concurrent connections
    ServicePointManager.DefaultConnectionLimit = 12;

    // For information on handling configuration changes
    // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

    bool result = base.OnStart();

    _storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
    var queueClient = _storageAccount.CreateCloudQueueClient();
    _pushQueue = queueClient.GetQueueReference("pushes");
    _pushQueue.CreateIfNotExists();

    CreatePushBroker();

    Trace.TraceInformation("Foo.PushProcess has been started");

    return result;
}

private async Task RunAsync(CancellationToken cancellationToken)
{
    while (!cancellationToken.IsCancellationRequested)
    {
        Trace.TraceInformation("Working");
        CloudQueueMessage message = null;
        try
        {
            message = _pushQueue.GetMessage();
            if (message != null)
            {
                ProcessItem(message);
            }
        }
        catch (Exception ex)
        {
            if (message != null && message.DequeueCount > 5)
                _pushQueue.DeleteMessage(message);

            Trace.TraceError("[WORKER] Retrieval Failure: " + ex);
        }

        await Task.Delay(1000, cancellationToken);
    }
}

注意一些代碼已被省略,但是這些都在初始化之后運行,並且在理論上沒有達到此異常。

我完全不知道可能導致這個問題的原因。 任何幫助將不勝感激 - 即使只是為了幫助我得到一個有用的例外。

UPDATE

我現在已將代碼縮減到下面 - 它就像Web工作者一樣簡單 - 而且我仍然得到例外。 我相信舊工作者正在被緩存,或者部署過程中存在問題。

public override void Run()
{
    Trace.TraceInformation("Foo.PushProcess is running");

    try
    {
        RunAsync(_cancellationTokenSource.Token).Wait(); // This is where the exceptions point to
    }
    catch (Exception ex)
    {
        Trace.TraceError("[WORKER] Run error: " + ex);
    }
    finally
    {
        _runCompleteEvent.Set();
    }
}

public override bool OnStart()
{
    // Set the maximum number of concurrent connections
    ServicePointManager.DefaultConnectionLimit = 12;

    // For information on handling configuration changes
    // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

    bool result = base.OnStart();

    return result;
}

private async Task RunAsync(CancellationToken cancellationToken)
{
    while (!cancellationToken.IsCancellationRequested)
    {
        Trace.TraceInformation("Working");

        // code removed for testing - no work is being done.

        await Task.Delay(1000, cancellationToken);
    }
}

我給了它一個旋轉,並沒有能夠得到這個重復我的結局。 我從部署的.MS Fx版本4.6運行的MSDN Azure映像中獲得了VS 2015 Enterprise(14.0.23107.0 D14REL)。 我安裝了Azure Tools和SDK 2.8。 我使用.NET Fx 4.5.2創建了一個新的Azure Cloud Service,並添加了一個輔助角色。

我剛從你的運行了一些稀疏代碼模板,如下所示:

public class WorkerRole : RoleEntryPoint
{
    private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
    private readonly ManualResetEvent runCompleteEvent = new ManualResetEvent(false);
    private CloudQueue _pushQueue;
    private CloudStorageAccount _storageAccount;

    public override void Run()
    {
        Trace.TraceInformation("WorkerRole1 is running");

        try
        {
            this.RunAsync(this.cancellationTokenSource.Token).Wait();
        }
        catch (Exception ex)
        {
            Trace.TraceError("[WORKER] Run error: " + ex);
        }
        finally
        {
            this.runCompleteEvent.Set();
        }
    }

    public override bool OnStart()
    {
        // Set the maximum number of concurrent connections
        ServicePointManager.DefaultConnectionLimit = 12;

        // For information on handling configuration changes
        // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
        bool result = base.OnStart();
        _storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
        var queueClient = _storageAccount.CreateCloudQueueClient();
        _pushQueue = queueClient.GetQueueReference("pushes");
        _pushQueue.CreateIfNotExists();

        CreatePushBroker();

        Trace.TraceInformation("Foo.PushProcess has been started");

        return result;

    }

    private void CreatePushBroker()
    {
        return;
    }

    public override void OnStop()
    {
        Trace.TraceInformation("WorkerRole1 is stopping");

        this.cancellationTokenSource.Cancel();
        this.runCompleteEvent.WaitOne();

        base.OnStop();

        Trace.TraceInformation("WorkerRole1 has stopped");
    }

    private async Task RunAsync(CancellationToken cancellationToken)
    {
        // TODO: Replace the following with your own logic.
        while (!cancellationToken.IsCancellationRequested)
        {
            Trace.TraceInformation("Working");
            CloudQueueMessage message = null;
            try
            {
                message = _pushQueue.GetMessage();
                if (message != null)
                {
                    ProcessItem(message);
                }
            }
            catch (Exception ex)
            {
                if (message != null && message.DequeueCount > 5)
                    _pushQueue.DeleteMessage(message);

                Trace.TraceError("[WORKER] Retrieval Failure: " + ex);
            }

            await Task.Delay(1000, cancellationToken);

        }
    }

    private void ProcessItem(CloudQueueMessage message)
    {
        return;
    }
}

}

這在本地模擬器中沒有問題,我繼續將它部署到啟用了IntelliTrace的美國西部,在一個小型實例VM上,並且有部署問題。 它運行在WA-GUEST-OS-4.26_201511-0客戶角色映像上,我能夠將RDP引入機器,我沒有看到任何與代碼或機器相關的問題。 您是否有任何其他二進制文件可能未包含在軟件包中,或者可能存在未正確定義的某些依賴項或存儲帳戶命名問題?

這是我的部署日志。 正如你所看到的那樣,我花了大約7分鍾從美國東部拉出存儲只是為了好玩:

1:11:25 AM - 警告:有包驗證警告。 1:11:26 AM - 檢查遠程桌面證書... 1:11:26 AM - 上傳證書... 1:11:42 AM - 應用診斷擴展。 1:12:24 AM - 使用服務管理URL'https://management.core准備部署AzureCloudService1 - 11/24/2015 1:11:19 AM,訂閱ID為“9a4715f5-acb8-4a18-8259-1c28b92XXXXX” 。 windows.net/ '... 1:12:24 AM - 正在連接... 1:12:24 AM - 驗證存儲帳戶'ericgoleastus'... 1:12:24 AM - 正在上傳包... 1:12 :28 AM - 創建... 1:13:15 AM - 創建部署ID:c5f26568707b46a3bd42466dd0bf7509。 1:13:15 AM - 角色的實例0 WorkerRole1正在創建虛擬機1:13:15 AM - 開始... 1:13:32 AM - 正在初始化... 1:14:36 AM - 角色的實例0 WorkerRole1正在啟動虛擬機1:16:11 AM - 角色WorkerRole1的實例0處於未知狀態1:16:43 AM - 角色WorkerRole1的實例0忙碌詳細信息:起始角色...系統正在初始化。 [2015-11-24T01:16:08Z] 1:19:50 AM - 角色WorkerRole1的實例0已准備好1:19:50 AM - 創建了Web應用程序URL: http ://quequetest.cloudapp.net/ 1:19 :上午50點 - 完成。

如果您可以在啟用IntelliTrace的情況下獲得更多詳細信息,請告訴我們。

此致,埃里克

為了解決這個問題,我簡單地刪除了擁有工作者角色的原始Cloud VM實例,重新創建了該角色並重新發布了該角色。 從那時起,它的工作非常好。

我仍然無法確定導致錯誤的原因,並且沒有任何其他問題與任何其他工作者角色。 我的假設是VM存在配置問題,無法通過代碼或Azure門戶進行修改。

暫無
暫無

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

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