c# - Azure 应用服务中的 System.BadImageFormatException : Bad binary signature.

标签 c# .net azure asp.net-core azure-web-app-service

我制作了一个 ASP.NET Core (.Net 5) Web API,它在我的本地计算机上运行得非常好。实际上,除了一个 Controller 之外,所有 Controller 都工作正常。当我向 DataStoreController 发出发布请求时,出现以下异常:

System.BadImageFormatException: Bad binary signature. (0x80131192)
at System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(RuntimeMethodHandleInternal method) at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType, Object target) at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda) at System.Linq.Expressions.Expression`1.Compile() at Microsoft.Extensions.Internal.ObjectMethodExecutor.GetExecutor(MethodInfo methodInfo, TypeInfo targetTypeInfo) at Microsoft.Extensions.Internal.ObjectMethodExecutor..ctor(MethodInfo methodInfo, TypeInfo targetTypeInfo, Object[] parameterDefaultValues) at Microsoft.Extensions.Internal.ObjectMethodExecutor.Create(MethodInfo methodInfo, TypeInfo targetTypeInfo, Object[] parameterDefaultValues) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerCache.GetCachedResult(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerProvider.OnProvidersExecuting(ActionInvokerProviderContext context) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionInvokerFactory.CreateInvoker(ActionContext actionContext) at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointFactory.<>c__DisplayClass7_0.b__0(HttpContext context) at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext) --- End of stack trace from previous location --- at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

我已经尝试过如果我将 Controller 内的方法设置为空并仅返回 null 会发生什么 - 但仍然是相同的错误。与其他 Controller 在包方面的唯一区别是 DataStoreController 使用 Stackexchange.Redis NuGet 包。

我的直觉告诉我,这是一个奇怪的 Azure Bug,但我很想从你那里得到一些意见/建议/答案。

最佳答案

好吧好吧。我已经找到了解决方案。

我停止并启动了应用服务,现在一切正常。这实际上可能是一个奇怪的 Azure 问题。

关于c# - Azure 应用服务中的 System.BadImageFormatException : Bad binary signature.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68496331/

相关文章:

c# - 如何在 C# 中卸载 C++ DLL

c# - 为什么 Visual Studio 有时不转到我的断点?

.net - 程序集生成和类型问题

c# - 在 .NET 中使用 key 的独占锁

C# SQL查询异常

azure - 我们可以使用带有 CCProj 的 Azure SDK 1.8 (Azure CCProj)

c# - 执行 IEnumerable 方法

c# - 过程输出捕获非常慢

azure - 在 Cosmos DB 中获取不同的值

c# - 读取作为 blob 上传的 azure 中的 excelsheet