预编译站点中的虚拟目录无法承载html文件

本文关键字:文件 html 站点 编译 虚拟 | 更新日期: 2023-09-27 18:02:16

我有一个msdeployed站点,它将包含一个虚拟目录到一个单独的内容文件夹。当我托管非预编译(即我的IIS托管网站指向我的项目目录在Visual Studio)。

在我的本地机器上,我可以重定向到虚拟目录中的html页面,并且html页面正确显示。但是,当我将项目部署到暂存服务器时,我得到以下错误:

The file '/MedrioWeb/help/info/default.html' has not been pre-compiled, and cannot be requested. 
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)   

在IIS中预编译的主web应用程序中,我在编译'buildProviders中添加了以下扩展:

<!-- forcing authentication for html pages -->
<add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
<add extension=".htm" type="System.Web.Compilation.PageBuildProvider" />

接下来,我有一个网页。在web应用程序下的虚拟目录中配置:

<?xml version="1.0"?>
<configuration>
    <system.web>
    </system.web>
  <system.webServer>
    <handlers>
         <add name="HTML" path="*.html" verb="GET, HEAD, POST, DEBUG"   type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script" />
         <add name="HTM" path="*.htm" verb="GET, HEAD, POST, DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script" />
     </handlers>
  </system.webServer>
</configuration>

TL;DR:我正在获得非asp.net文件类型的预编译错误。我只包括扩展,以便我的自定义表单身份验证模块用于验证用户登录到查看html页面。为什么这不能与预编译的代码一起工作,vs我在本地机器上的非预编译版本?

预编译站点中的虚拟目录无法承载html文件

好的,没有咬人的?

我最终删除了我们的构建预编译任务。