iis - WebMatrix 将 .html 文件解析为 .asp

标签 iis webmatrix iis-express server-side-includes

我有一个扩展名为 .html 的文件,其中包含:

<!--#include virtual="filename"-->

指令,我正在使用 Microsoft WebMatrix。当我从 WebMatrix 运行网页时,不处理该指令,而是该指令显示在 HTML 中。如何配置 WebMatrix 以将这些页面视为 .asp 文件?

最佳答案

您需要配置 Web 服务器以将 .html 文件映射到 asp.dll。如果您想使用 IIS Express 在本地执行此操作,您可以在 <handlers> 部分下的 applicationhost.config 文件中添加一个新条目,如下所示:

    <add name="ASPClassicHtml" path="*.html" verb="GET,HEAD,POST" 
         modules="IsapiModule" scriptProcessor="%IIS_BIN%\asp.dll" 
         resourceType="File" />

这基本上是 ASPClassic 现有条目的副本,但指向 html 文件。您通常可以在 My Documents > IISExpress > config 中找到 applicationhost.config。

关于iis - WebMatrix 将 .html 文件解析为 .asp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5787319/

相关文章:

asp.net - Visual Studio - 在浏览器 (iis) 中查看时使用子文件夹作为根目录

iis-express - 如何将 IIS Express 作为通过 Windows 服务启动的进程运行

visual-studio - 停止IIS Express自动退出

asp.net-mvc-3 - 站点重定向到服务器上的错误登录页面,但在本地工作正常

c# - IIS 8.5 覆盖自定义 JSON 错误响应,而是返回默认的 500 错误响应页面。如何让 IIS 8.5 返回我的自定义错误?

asp.net - IIS 7/ASP.Net 管道如何工作?

sql-server-ce - 在 SQL Server CE 4 中使用 GetUTCDate

sql - 按 Webmatrix 中单独表中的条目排序

c# - Razor 语法/WebMatrix - C# 问题

php - IIS + PHP + MySQL 返回 500 - 内部服务器错误