简体   繁体   English

服务器端包含HTML

[英]Server Side Includes for HTML

How do I enable Server Side Includes for html file hosted on IIS 8.5? 如何为IIS 8.5上托管的html文件启用服务器端包含? Like: 喜欢:

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

Currently, I don't see include file (html) content when I open page in browser. 目前,在浏览器中打开页面时看不到包含文件(html)的内容。

Edit: I manually added module mapping of ServerSideIncludeModule for website & still doesn't work. 编辑:我为网站手动添加了ServerSideIncludeModule的模块映射,但仍然无法正常工作。

You have the correct module mapping handler. 您具有正确的模块映射处理程序。

When you add the module mapping under Handler Mapping in IIS 8.5 double check that you specify *.html as the file type; 当您在IIS 8.5的“ 处理程序映射”下添加模块映射时,请仔细检查是否将* .html指定为文件类型; don't forget the asterisk (the *). 不要忘记星号(*)。 I had added it only as .html, and that won't work. 我仅将其添加为.html,但无法正常工作。

Also, when you add the module mapping, make sure you click on the "Request Restrictions..." button; 另外,添加模块映射时,请确保单击“请求限制...”按钮; on the Mapping tab for restrictions, the checkbox for "Invoke handler only if request is mapped to:" should be checked, and the selection should be set to File. 在“限制”的“映射”选项卡上,应选中“仅在请求映射到时才调用处理程序:”复选框,并将选择设置为“文件”。 More importantly, on the Verbs tab for the restriction, make sure that the lower dot is selected for "One of the following verbs:" and in the field below you should have "GET, HEAD, POST". 更重要的是,在限制的“动词”选项卡上,确保为“以下动词之一:”选择了较低的点,并且在下面的字段中应具有“ GET,HEAD,POST”。 Lastly, on the Access tab you should have "Script" selected. 最后,在“访问”选项卡上,应该选择“脚本”。

Lastly, if you haven't done the appcmd.exe to set ssiDisable to false, you'll need to run this at at command prompt (run the command prompt as Admin). 最后,如果尚未完成appcmd.exe来将ssiDisable设置为false,则需要在命令提示符处以管理员身份运行此命令。

 cd %windir%\\system32\\inetsrv appcmd.exe set config "Name_of_website_as_it_appears_in_IIS_Manager" -section:system.webServer/serverSideInclude /ssiExecDisable:"False" /commit:apphost 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM