首页 文章

无法启动Azure辅助角色,异常代码0xe0434352和0xC0000035

提问于
浏览
3

在模拟器中本地运行时,Web worker工作正常 . 但是,每当我更新在Azure VM上运行的Web工作器时,我在事件查看器中都会遇到以下异常异常,并且角色将无法启动:

应用程序:WaWorkerHost.exe Framework版本:v4.0.30319描述:由于未处理的异常,进程已终止 . 异常信息:System.AggregateException Stack:位于System.Threading.Tasks.Task.Wait(Int32,System.Threading.CancellationToken)的System.Threading.Tasks.Task.Wait()at Foo.PushProcess.WorkerRole.Run()at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.ContextCallback,System . )中的Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()位于Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__2() . System.Threading.ExecutionContext.Run的System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,Boolean)中的Object,Boolean)(System.Threading.ExecutionContext,System.Threading . System.Threading.ThreadHelper.ThreadStart()中的ContextCallback,System.Object)内部异常:任务被取消 .

错误应用程序名称: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报告ID: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);
    }
}

2 回答

  • 0

    我给了它一个旋转,并没有能够得到这个重复我的结局 . 我从部署的.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 - 为AzureCloudService1准备部署 - 2015年11月24日上午1:11:19订阅ID '9a4715f5-acb8-4a18-8259-1c28b92XXXXX'使用服务管理URL'https://management.core.windows.net/ '... 1:12:24 AM - Connecting... 1:12:24 AM - Verifying storage account ' 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 - 角色的实例0 WorkerRole1已准备好1:19:50 AM - 创建的网络应用URL:http://quequetest.cloudapp.net/ 1:19:50 AM - 完成 .

    如果您可以在启用IntelliTrace的情况下获得更多详细信息,请告诉我们 .

    此致,埃里克

  • 0

    为了解决这个问题,我简单地删除了拥有工作者角色的原始Cloud VM实例,重新创建了该角色并重新发布了该角色 . 从那时起,它的工作非常好 .

    我仍然无法确定导致错误的原因,并且没有任何其他问题与任何其他工作者角色 . 我的假设是VM存在配置问题,无法通过代码或Azure门户进行修改 .

相关问题