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

时间:2014-05-06 23:42:45

标签: c# asp.net forms-authentication pre-compilation

我有一个msdeployed站点,它将包含一个单独的内容文件夹的虚拟目录。当我托管非预编译时(I.E.我的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应用程序中,我向compile \ buildProviders添加了以下扩展:

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

接下来,我在Web应用程序下的虚拟目录中有一个web.config:

<?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页面。 为什么这不能使用预编译的代码,而不是我本地计算机上的非预编译版本?

1 个答案:

答案 0 :(得分:0)

好的,没有咬人?

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