通过web.config做html映射aspx

来源:互联网 发布:单片机论坛网 编辑:程序博客网 时间:2024/06/09 19:49

在将dtcms发布之后,绑定到iis后,发现html页面都不能访问,在dtcms论坛里找到解决方法:

http://bbs.dtcms.net/forum.php?mod=viewthread&tid=18&extra=


一般在web.config中添加这个映射配置.是虚拟主机的用户才需要用到
注意:以下代码已通过测试,在IIS6.0版本以上可以使用
.NET 2.0的配置代码如下

<!--2.0版本--><system.webServer>        <handlers>             <add name="html-ISAPI-2.0" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptprocessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" precondition="classicMode,runtimeVersionv2.0,bitness32" responsebufferlimit="0" />        </handlers></system.webServer>..NET 4.0的配置代码如下<!--4.0版本--><system.webServer>        <handlers>             <add name="html-4.0" path="*.html" verb="*" modules="IsapiModule" scriptprocessor="%SystemRoot%\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" resourcetype="unspecified" precondition="classicmode,runtimeversionv4.0,bitness32" />        </handlers></system.webServer>


对不起大家忘写一个最重要的配置说明了.现在补充

<!--将如下代码copy到handlers节点上前--><modules runallmanagedmodulesforallrequests="true">      <add name="HttpModule_rewriter" type="DTcms.Web.UI.HttpModule" /></modules>



我测试不加modules节点,也可以使用。

在Web.config中添加htm伪静态映射,htm伪静态并没有在iis中的处理程序映射进行相关设置,却可以实现伪静态。
因为在iis中的设置也是做这个工作,即把*.html映射到了aspnet_isapi.dll引擎解析。

<system.webServer><handlers>  <add name="htmlrequest" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" /></handlers></system.webServer>

 

0 0