gpt4 book ai didi

c# - Azure辅助角色抛出System.IO.FileNotFoundException

转载 作者:行者123 更新时间:2023-12-03 03:08:21 26 4
gpt4 key购买 nike

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

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

来源:.NET 运行时

Application: WaWorkerHost.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at System.ModuleHandle.ResolveType(System.Reflection.RuntimeModule, Int32, IntPtr*, Int32, IntPtr*, Int32, System.Runtime.CompilerServices.ObjectHandleOnStack) at System.ModuleHandle.ResolveType(System.Reflection.RuntimeModule, Int32, IntPtr*, Int32, IntPtr*, Int32, System.Runtime.CompilerServices.ObjectHandleOnStack) at System.ModuleHandle.ResolveTypeHandleInternal(System.Reflection.RuntimeModule, Int32, System.RuntimeTypeHandle[], System.RuntimeTypeHandle[]) at System.ModuleHandle.ResolveTypeHandle(Int32, System.RuntimeTypeHandle[], System.RuntimeTypeHandle[]) at System.Reflection.RuntimeModule.ResolveType(Int32, System.Type[], System.Type[]) at 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) at System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeModule, Int32, Int32, System.RuntimeType, Boolean, System.Collections.IList, Boolean) at System.Reflection.CustomAttribute.GetCustomAttributes(System.Reflection.RuntimeAssembly, System.RuntimeType) at Microsoft.WindowsAzure.Hosts.Worker.Loader.CreateConsoleRole(Microsoft.WindowsAzure.Hosts.Worker.Parameters) at Microsoft.WindowsAzure.Hosts.Worker.Loader.Main(System.String[])

来源:应用程序错误

Faulting application name: WaWorkerHost.exe, version: 2.7.1198.768, time stamp: 0x57159090 Faulting module name: KERNELBASE.dll, version: 6.3.9600.18340, time stamp: 0x57366075 Exception code: 0xe0434352 Fault offset: 0x0000000000008a5c Faulting process id: 0xf20 Faulting application start time: 0x01d287c5480b416f Faulting application path: E:\base\x64\WaWorkerHost.exe Faulting module path: D:\Windows\system32\KERNELBASE.dll Report Id: 85f9c3f7-f3b8-11e6-80c1-0004ff9da18e Faulting package full name: Faulting package-relative application ID:

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

我自己的日志记录也没有提供太多见解。我所知道的是 WorkerRole 没有调用 OnStart 方法。

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

提前致谢。

最佳答案

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

我继续更新了 Nuget 中辅助角色和类库项目的所有 DLL。那里的某些东西解决了这个问题(我知道,很糟糕吧?)但后来我遇到了另一个问题:

Application: WaWorkerHost.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.TypeInitializationException Stack: at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.Initialize() at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(String[] args) at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.Initialize(System.String[]) at Microsoft.WindowsAzure.Hosts.Worker.Loader.CreateConsoleRole(Microsoft.WindowsAzure.Hosts.Worker.Parameters) at Microsoft.WindowsAzure.Hosts.Worker.Loader.Main(System.String[])

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

AzureTools includes an option under the Utils tab to attach a debugger to the startup of a process. Switch to the Utils tab, click Attach Debugger, select WaIISHost from the process list, then click Attach Debugger. You will see WaIISHost show up in the Currently Monitoring list. AzureTools will attach WinDBG (or whatever you specify in Debugger Location) to a monitored process the next time that process starts up. Note that AzureTools will only attach the next instance of the target process that is started – if the process is currently running then AzureTools will ignore it.

通过此调试,我发现我在辅助角色的 app.config 文件中缺少 filter 标记的 type 属性。一旦我添加了如下所示的内容,一切就就绪并且辅助角色部署成功。

<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 引用。

希望这对其他人有帮助。

关于c# - Azure辅助角色抛出System.IO.FileNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42259037/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com