WebMatrix将.html文件解析为.asp

Bri*_*her 4 iis server-side-includes webmatrix iis-express

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

<!--#include virtual="filename"-->
Run Code Online (Sandbox Code Playgroud)

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

Mik*_*ind 7

您需要配置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" />
Run Code Online (Sandbox Code Playgroud)

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