【问题标题】:Azure worker role throwing System.IO.FileNotFoundExceptionAzure 辅助角色抛出 System.IO.FileNotFoundException
【发布时间】:2017-02-15 20:08:25
【问题描述】:

我重新部署了一个可操作的 Azure 辅助角色,并进行了一些更改,其中涉及引用我已设置的新类库项目,并开始看到辅助角色无休止地重新启动/回收。

事件查看器应用程序日志提供的帮助很少,因为我收到的错误非常普遍。

来源:.NET 运行时

应用程序:WaWorkerHost.exe 框架版本:v4.0.30319 说明:进程因未处理的异常而终止。 异常信息:System.IO.FileNotFoundException 堆: 在 System.ModuleHandle.ResolveType(System.Reflection.RuntimeModule,Int32,IntPtr*,Int32,IntPtr*,Int32,System.Runtime.CompilerServices.ObjectHandleOnStack) 在 System.ModuleHandle.ResolveType(System.Reflection.RuntimeModule,Int32,IntPtr*,Int32,IntPtr*,Int32,System.Runtime.CompilerServices.ObjectHandleOnStack) 在 System.ModuleHandle.ResolveTypeHandleInternal(System.Reflection.RuntimeModule,Int32,System.RuntimeTypeHandle[],System.RuntimeTypeHandle[]) 在 System.ModuleHandle.ResolveTypeHandle(Int32,System.RuntimeTypeHandle[],System.RuntimeTypeHandle[]) 在 System.Reflection.RuntimeModule.ResolveType(Int32,System.Type[],System.Type[]) 在 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(System.Reflection.CustomAttributeRecord, System.Reflection.MetadataImport, System.Reflection.Assembly ByRef, System.Reflection.RuntimeModule, System.Reflection.MetadataToken, System.RuntimeType, Boolean, System.Object[ ], System.Collections.IList, System.RuntimeType ByRef, System.IRuntimeMethodInfo ByRef, Boolean ByRef, Boolean ByRef) 在 System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeModule,Int32,Int32,System.RuntimeType,布尔值,System.Collections.IList,布尔值) 在 System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeAssembly,System.RuntimeType) 在 Microsoft.WindowsAzure.Hosts.Worker.Loader.CreateConsoleRole(Microsoft.WindowsAzure.Hosts.Worker.Parameters) 在 Microsoft.WindowsAzure.Hosts.Worker.Loader.Main(System.String[])

来源:应用程序错误

错误应用程序名称:WaWorkerHost.exe,版本:2.7.1198.768,时间戳:0x57159090 错误模块名称:KERNELBASE.dll,版本:6.3.9600.18340,时间戳:0x57366075 异常代码:0xe0434352 故障偏移:0x0000000000008a5c 故障进程ID:0xf20 错误应用程序启动时间:0x01d287c5480b416f 错误的应用程序路径:E:\base\x64\WaWorkerHost.exe 错误模块路径:D:\Windows\system32\KERNELBASE.dll 报告 ID:85f9c3f7-f3b8-11e6-80c1-0004ff9da18e 故障包全名: 错误的包相关应用程序 ID:

我已经搜索过这个,但没有遇到任何人收到如此通用的错误消息。

我自己的日志记录也没有提供太多洞察力。我只知道 WorkerRole 没有命中 OnStart 方法。

还有其他日志可以帮助缩小问题范围吗?

提前致谢。

【问题讨论】:

    标签: c# .net azure reflection azure-worker-roles


    【解决方案1】:

    想通了...但不是以最优雅的方式。

    我继续更新 Nuget 中的所有 DLL,用于辅助角色和类库项目。里面的东西解决了这个问题(我知道,不好对吗?)但后来我遇到了另一个问题:

    应用程序:WaWorkerHost.exe 框架版本:v4.0.30319 说明:进程因未处理的异常而终止。 异常信息:System.TypeInitializationException 堆: 在 Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.Initialize() 在 Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(String[] args) 在 Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(System.String[]) 在 Microsoft.WindowsAzure.Hosts.Worker.Loader.CreateConsoleRole(Microsoft.WindowsAzure.Hosts.Worker.Parameters) 在 Microsoft.WindowsAzure.Hosts.Worker.Loader.Main(System.String[])

    为了解决这个问题,我最终偶然发现了here,这让我找到了this。我在我的 Worker Role VM 上下载了 AzureTools,并将调试器附加到回收 WaWorkerHost 进程。以下是上述链接的相关摘录:

    AzureTools 在 Utils 选项卡下包含一个选项,用于将调试器附加到进程的启动。切换到 Utils 选项卡,单击 Attach Debugger,从进程列表中选择 WaIISHost,然后单击 Attach Debugger。您将看到 WaIISHost 出现在当前监控列表中。 AzureTools 将在下次启动时将 WinDBG(或您在调试器位置中指定的任何内容)附加到受监视的进程。请注意,AzureTools 只会附加启动的目标进程的下一个实例——如果该进程当前正在运行,那么 AzureTools 将忽略它。

    通过此调试,我发现我在 Worker Role 的 app.config 文件中缺少 filter 标记的 type 属性。如下所示添加后,一切就绪,worker 角色部署成功。

    <system.diagnostics>
        <trace>
          <listeners>
            <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
              <filter type="" />
            </add>
          </listeners>
        </trace>
      </system.diagnostics>
    

    请注意,要解决第一个错误,我也可以使用 AzureTools 并通过这种方式进行调试。在大多数情况下,我会认为这是可取的方法。碰巧我直到遇到第二个错误时才知道该实用程序,并且鉴于我的应用程序尚未生产化,我有能力更新我的 DLL 引用。

    希望这对其他人有所帮助。

    【讨论】:

      猜你喜欢
      • 2013-02-08
      • 1970-01-01
      • 2011-08-22
      • 2014-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多