我在 Azure 中部署了一个应用程序,从今天早上开始我开始收到此错误:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Diagnostics.DiagnosticListener' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Diagnostics.ProductionBreakpointsStub' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at __EnsureBootstrap__System.Diagnostics.DiagnosticSource.dll() at System.Diagnostics.DiagnosticListener..cctor() --- End of inner exception stack trace --- at System.Diagnostics.DiagnosticListener..ctor(String name) at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at MotionCatalyst.Online.Program.Main(String[] args)
我的应用程序是一个 asp.net core 应用程序,但目标是完整的框架。
这是项目文件:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
本地正在运行。有什么帮助吗?
最佳答案
我认为当前版本的 Application Insights 扩展 (2.4.7) 可能存在错误。如果从应用服务中删除扩展程序,错误会消失吗?
另一个解决方法是手动删除以下文件,但我认为它也会禁用快照调试功能:
d:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation32\ProductionBreakpoints_x86.config
d:\home\SiteExtensions\Microsoft.ApplicationInsights.AzureWebSites\Instrumentation64\ProductionBreakpoints_x64.config
关于c# - 无法加载在 Azure 中部署的应用程序中的类型“System.Diagnostics.ProductionBreakpointsStub 错误”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47411101/