首页 > 解决方案 > 更新到 httpRuntime targetFramework="4.7.2" 时出现 Webforms InvalidOperationException

问题描述

我正在将我的旧代码更新为目标 4.7.2,以在我们的应用程序中创建一致性。这是一个旧的网络表单应用程序。它是一个 aspx 和一个主文件。

我使用 Visual Studio 将目标更改为 4.7.2,这更新了我的 csproj 和 webconfig

<system.web>
    <compilation debug="true" targetFramework="4.7.2"/>
    <httpRuntime targetFramework="4.5.2"/>
</system.web>

如果我将目标框架更新到 4.7.2,我会收到以下错误

[InvalidOperationException: Server could not create ASP.appskinmaster_master.]
   __ASP.FastObjectFactory_app_web_31ycbdmm.Create_ASP_appskinmaster_master() in c:\Users\ME\AppData\Local\Temp\Temporary ASP.NET Files\property_tax\cc244ff3\3e690eb6\App_Web_31ycbdmm.1.cs:0
   System.Web.Compilation.BuildResultCompiledType.CreateInstance() +31
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +826
   System.Web.UI.Page.get_Master() +56
   System.Web.UI.Page.ApplyMasterPage() +15
   System.Web.UI.Page.PerformPreInit() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +302

我可以毫无问题地将其一直更新到 4.7.1。

此处列出的任何内容似乎都不适用https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/runtime/4.7.1-4.7.2

标签: c#asp.netwebforms.net-4.7.2

解决方案


推荐阅读