c# - 无法加载在 Azure 中部署的应用程序中的类型“System.Diagnostics.ProductionBreakpointsStub 错误”

标签 c# asp.net .net azure

我在 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/

相关文章:

Android 3 调用 WCF REST

.net - Windows 2003 与 .NET 3.5 SP1 一起崩溃

c# - Asp.net 控件到 HTML

c# - .NET 中是否明确将无限循环作为特例处理?

c# - 通过 '&' ,从选定的选项值返回,在 url

c# - 使用 ASP.NET 代码中的凭据从网络位置读取文件

ASP.Net 可移植服务器

c# - 为什么不推荐使用 mouse_event?

ASP.NET Identity 如何为自定义 ApplicationUser 添加必需的属性?

c# - 以异步方式调用普通方法的最佳方法是什么?