ASP.NET WebForm App_Theme 导致编译错误

标签 asp.net webforms

我有一个引用这样的主题的 WebForm:

<%@ Page Title="Test" Language="C#" MasterPageFile="~/Test.master" AutoEventWireup="true"
CodeFile="Test.aspx.cs" Inherits="Test"  Theme="TestTheme"%>

并且TestTheme仅包含一个Test.skin文件,其内容如下:

<asp:Button runat="server" CssClass="button" />

如果我执行该页面,我总是会收到如下编译错误消息:

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
Compiler Error Message: The compiler failed with error code -1073741701.

仔细查看生成的 html 后,我发现了这个隐藏消息:

<!-- 
[HttpCompileException]: External component has thrown an exception.
   at System.Web.Compilation.AssemblyBuilder.Compile()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(String themeName)
   at System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(HttpContext context, String themeName)
   at System.Web.UI.Page.InitializeThemes()
   at System.Web.UI.Page.PerformPreInit()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)...... and many more

但是,如果我删除主题引用,一切都会正常。

我猜编译App_Theme文件可能有问题,但不知道如何解决。

有什么想法吗?

最佳答案

我也遇到了同样的问题。看起来它发生在 Win 8.1 或 Win Server 2012 R2 上。 这就是我所做的:

  • 卸载了 Visual Studio 2015
  • 已卸载 .Net Framework 4.6
  • 卸载了以下 Windows 更新(KB3074232、KB3098000、KB3098785、KB3074553、KB3083185、KB3097992、KB3097997)
  • Windows 重新启动

之后,我按此顺序再次安装了更新(KB3097992、KB3097997)并且它起作用了。

关于ASP.NET WebForm App_Theme 导致编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32514606/

相关文章:

c# - Web 表单中的 ASP.Net 图表适用于本地系统,不适用于 Web 服务器

css - 移动 Web 表单 - 可以使用 CSS 和 HTML 为 Android 和 iPhone 自定义单选按钮样式吗?

ASP.NET 和 OWIN Cookies Azure Open ID 不工作

asp.net - 无法将数据放入固定宽度的 GridView 单元格中

asp.net - ASP.NET 4.0 子应用程序上的 IIS 500.19 错误

c# - DotNetOpenAuth:网络表单,入门

javascript - ASP.NET MVC - 将包含数组的 FormData 映射到模型类

asp.net - ASP.NET 页面上的多个表单

asp.net-mvc - ASP.NET MVC 替代品?

c# - ASP.NET 网络 API : How to authorize for static HTML content