Sch*_*zer 2 c# clickonce .net-4.8
首先是简单的事情:我有一个 .net 4.7.2 clickonce winform 应用程序,它不会在 .net 4.8(Windows 更新附带)安装后立即启动。如果您卸载 .net 4.8 一切正常。当您单击.appref.ms开始菜单中的快捷方式时会发生什么,它会启动对新版本的检查,然后它就会消失。所以我检查了事件日志,它揭示了这一点:
System.Configuration.ConfigurationErrorsException
at System.Configuration.BaseConfigurationRecord.EvaluateOne(System.String[], System.Configuration.SectionInput, Boolean, System.Configuration.FactoryRecord, System.Configuration.SectionRecord, System.Object)
at System.Configuration.BaseConfigurationRecord.Evaluate(System.Configuration.FactoryRecord, System.Configuration.SectionRecord, System.Object, Boolean, Boolean, System.Object ByRef, System.Object ByRef)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(System.String, Boolean, Boolean, Boolean, Boolean, System.Object ByRef, System.Object ByRef)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(System.String, Boolean, Boolean, Boolean, Boolean, System.Object ByRef, System.Object ByRef)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(System.String, Boolean, Boolean, Boolean, Boolean, System.Object ByRef, System.Object ByRef)
at System.Configuration.BaseConfigurationRecord.GetSection(System.String)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String)
at System.Configuration.ConfigurationManager.GetSection(System.String)
at System.ServiceModel.Activation.AspNetEnvironment.GetConfigurationSection(System.String)
at System.ServiceModel.Configuration.ConfigurationHelpers.GetAssociatedSection(System.Configuration.ContextInformation, System.String)
at System.ServiceModel.Configuration.ConfigurationHelpers.GetAssociatedBindingCollectionElement(System.Configuration.ContextInformation, System.String)
at System.ServiceModel.BasicHttpsBinding.ApplyConfiguration(System.String)
at xx.xx.xx.xx.WinClient.Initialize.Execute()
at xx.xx.xx.Bootstrapper.Bootstrapper+<>c.<Run>b__0_4(xx.xx.xx.Bootstrapper.IBootstrapperCommand)
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].ForEach(System.Action`1<System.__Canon>)
at xx.xx.xx.Bootstrapper.Bootstrapper.Run()
at xx.xx.xx.xx.WinClient.Program.Main()
Run Code Online (Sandbox Code Playgroud)
这看起来很熟悉,因为我确实使用 BasicHttpsBinding 作为 SAP Web 服务参考。所以我想调试代码,以便找到有关为什么在安装最新的 .net 版本时这些 BasicHttpsBindings 不起作用的更多详细信息。不幸的是,该应用程序在调试时运行正常。更糟糕的是……当我直接启动文件<user>/app夹中的 .exe 文件时,它也能正常工作。它不工作的唯一一次是当我使用.appref-ms快捷方式启动应用程序时- 显然 - 安装了 .net 4.8。
有没有其他人在 .net 4.8 中遇到过这个问题并能引导我走上正确的道路?
小智 5
@Schadensbergenzer 感谢您报告此事。这听起来像是最近的一个问题,它影响了 10 月份发布的 .NET Framework 4.8 补丁程序的 clickonce 应用程序。您可以尝试将以下内容添加到您的应用程序配置文件中吗?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Reflection.DoNotForceOrderOfConstructors=true"/>
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)