IIS8.5伪静态设置后,网页404


使用微软的URLRewriter.dll来设置伪静态
比如: http://127.0.0.1/aaa.html
想要转到: http://127.0.0.1/test.aspx
webconfig配置文件:


 <?xml version="1.0"?>
<configuration>
  <!--使用URLRewriter.dll -->
  <configSections>
    <section name="RewriterConfig" requirePermission="false" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
  </configSections>

  <RewriterConfig>
    <Rules>
      <RewriterRule>
        <LookFor>~/*.html</LookFor>
        <SendTo>~/test.aspx</SendTo>
      </RewriterRule>
    </Rules>
  </RewriterConfig>

  <system.web>
    <httpHandlers>
      <!--使用URLRewriter.dll-->
      <add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
      <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
    </httpHandlers>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
</configuration>

结果,打开 http://127.0.0.1/aaa.html 的时候,网页会报404错误:

404 - 找不到文件或目录。
您要查找的资源可能已被删除,已更改名称或者暂时不可用。

iis asp.net

carrie 12 years ago

Your Answer