iis6上用的伪静态规则在iis7.5怎么用?

下面是iis6网站上用的伪静态的规则,现在网站迁移到了iis7.5上,怎么叫下面的伪静态规则生效?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
    <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
  </configSections>
  <RewriterConfig>
    <Rules>

      <RewriterRule>
        <LookFor>~/index\.html</LookFor>
        <SendTo>~/index.aspx</SendTo>
      </RewriterRule>

      <RewriterRule>
        <LookFor>~/LineList-(\d+)\.html</LookFor>
        <SendTo>~/LineList.aspx?classId=$1</SendTo>
      </RewriterRule>

      <RewriterRule>
        <LookFor>~/zhjd-(\d+)\.html</LookFor>
        <SendTo>~/cgal.aspx?classId=$1</SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/Products-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/cplist.aspx?classid=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/zthg-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/zthg.aspx?classid=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/zthg1-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/zthg1.aspx?classid=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/zjtd-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/zjtd.aspx?classid=$1&Page=$2]]></SendTo>
      </RewriterRule>
      


      <RewriterRule>
        <LookFor>~/News-(\d+)\.html</LookFor>
        <SendTo>~/News.aspx?classid=$1</SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/xinnews-(\d+)\.html</LookFor>
        <SendTo>~/xinnews.aspx?classid=$1</SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/newms-(\d+)\.html</LookFor>
        <SendTo>~/newms.aspx?classid=$1</SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/News-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/News.aspx?classId=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/cgal-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/cgal.aspx?classId=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/cplist1-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/cplist1.aspx?classId=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/newms-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/newms.aspx?classId=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/shengnei-(\d+)/(\d{0,999999})\.html</LookFor>
        <SendTo><![CDATA[~/shengnei.aspx?classId=$1&Page=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/detail-(\d+)-(\d+)\.html</LookFor>
        <SendTo><![CDATA[~/detail.aspx?ClassId=$1&Id=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/pp\.html</LookFor>
        <SendTo><![CDATA[~/pp.aspx?&Id=124]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/hzfa\.html</LookFor>
        <SendTo><![CDATA[~/xjxm.aspx?&Id=121]]></SendTo>
      </RewriterRule>


      
      <RewriterRule>
        <LookFor>~/ylcd\.html</LookFor>
        <SendTo><![CDATA[~/ylcd.aspx?&Id=127]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/fwtx\.html</LookFor>
        <SendTo><![CDATA[~/xjxm1.aspx?&Id=128]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/fuwutx\.html</LookFor>
        <SendTo><![CDATA[~/fuwutx.aspx?&Id=128]]></SendTo>
      </RewriterRule>    



      <RewriterRule>
        <LookFor>~/zzry\.html</LookFor>
        <SendTo><![CDATA[~/zzry.aspx?&Id=134]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/ysfw\.html</LookFor>
        <SendTo><![CDATA[~/ysfw.aspx?&Id=125]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/jmfc\.html</LookFor>
        <SendTo><![CDATA[~/jmfc.aspx?&Id=133]]></SendTo>
      </RewriterRule>
      


      <RewriterRule>
        <LookFor>~/ysfw\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=125]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/jmys\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=133]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/zyys\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=127]]></SendTo>
      </RewriterRule>



     <RewriterRule>
        <LookFor>~/ydys\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=129]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/espa\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=128]]></SendTo>
      </RewriterRule>




      <RewriterRule>
        <LookFor>~/mbks\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=130]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/tkjs\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=131]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/zjms\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=132]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/fxry\.html</LookFor>
        <SendTo><![CDATA[~/jiameng.aspx?&Id=134]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/cdetail-(\d+)-(\d+)\.html</LookFor>
        <SendTo><![CDATA[~/cdetail.aspx?ClassId=$1&Id=$2]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/zsjm-(\d+)-(\d+)\.html</LookFor>
        <SendTo><![CDATA[~/zsjm.aspx?Id=117&option=6]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/lxwm\.html</LookFor>
        <SendTo><![CDATA[~/lxwm.aspx?Id=126]]></SendTo>
      </RewriterRule>


     
      <RewriterRule>
        <LookFor>~/qywh\.html</LookFor>
        <SendTo><![CDATA[~/qywh.aspx?Id=129]]></SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/jiameng-(\d+)\.html</LookFor>
        <SendTo>~/jiameng.aspx?Id=$1</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/LinesYD-(\d+)\.html</LookFor>
        <SendTo>~/LinesYD.aspx?id=$1</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/Contact-(\d+)\.html</LookFor>
        <SendTo>~/Contact.aspx?id=$1</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/mdcx\.html</LookFor>
        <SendTo>~/mdcx.aspx</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/danfangdj\.html</LookFor>
        <SendTo>~/danfangdj.aspx</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/dianzan\.html</LookFor>
        <SendTo>~/dianzan.aspx</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/huobao\.html</LookFor>
        <SendTo>~/huobao.aspx</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/5akaidian\.html</LookFor>
        <SendTo>~/5akaidian.aspx</SendTo>
      </RewriterRule>


      <RewriterRule>
        <LookFor>~/xiaoaiye\.html</LookFor>
        <SendTo>~/xiaoaiye.aspx</SendTo>
      </RewriterRule>




      <RewriterRule>
        <LookFor>~/moshi\.html</LookFor>
        <SendTo><![CDATA[~/moshi.aspx?&Id=121]]></SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/rencaipx\.html</LookFor>
        <SendTo><![CDATA[~/rencaipx.aspx?&Id=121]]></SendTo>
      </RewriterRule>




      <RewriterRule>
        <LookFor>~/jmzq\.html</LookFor>
        <SendTo>~/jmzq.aspx</SendTo>
      </RewriterRule>



      <RewriterRule>
        <LookFor>~/yljd\.html</LookFor>
        <SendTo><![CDATA[~/yljd.aspx?&Id=121]]></SendTo>
      </RewriterRule>

    


      <RewriterRule>
        <LookFor>~/zxth\.html</LookFor>
        <SendTo>~/zxth.aspx</SendTo>
      </RewriterRule>






    </Rules>
  </RewriterConfig>

  <!-- appSettings网站信息配置-->
  <appSettings>
    <add key="Configpath" value="~/XmlConfig/webset.config" />
    <!--<add key="DbPath" value="~/App_Data/DtCms.aspx"/>-->
    <add key="DbPath" value="~/App_Data/DtCms.mdb" />
  </appSettings>
  <!-- 数据库连接字符串-->
  <connectionStrings>
    <add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" />
  </connectionStrings>
  <system.web>
    <httpModules>
      <add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />

    </httpModules>
    <httpHandlers>
      <add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
      <add verb="*" path="*.xml" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
      <add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2" />
    </httpHandlers>
    <!-- 
            设置 compilation debug="true" 可将调试符号插入
            已编译的页面中。但由于这会
            影响性能,因此只在开发过程中将此值 
            设置为 true。
        -->
    <customErrors mode="Off" />
    <compilation debug="true">
      <buildProviders>
        <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
        <add extension=".xml" type="System.Web.Compilation.PageBuildProvider" />
      </buildProviders>
    </compilation>
    <!--
            通过 <authentication> 节可以配置 ASP.NET 用来 
            识别进入用户的
            安全身份验证模式。 
        -->
    <authentication mode="Windows" />
    <!--
            如果在执行请求的过程中出现未处理的错误,
            则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
            开发人员通过该节可以配置
            要显示的 html 错误页
            以代替错误堆栈跟踪。

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <httpRuntime maxRequestLength="20480" executionTimeout="600" />

  </system.web>
   <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
        <defaultDocument>
            <files>
                <add value="index.aspx" />
            </files>
        </defaultDocument>
  </system.webServer>


</configuration>
阅读 490
avatarAI BotBETA

在IIS 7.5中,你可以使用URL重写模块(URL Rewrite Module)来实现IIS6中的伪静态规则。下面是如何将给出的伪静态规则迁移到IIS 7.5的步骤:

  1. 安装URL重写模块
    首先,确保你的IIS 7.5已经安装了URL重写模块。如果没有安装,你可以通过IIS管理器或Web Platform Installer来安装它。
  2. 打开IIS管理器
    打开IIS管理器并导航到你的网站。
  3. 配置URL重写规则
    在网站的功能视图中,双击“URL重写”图标。这将打开URL重写规则的界面。
  4. 添加规则
    在“URL重写”界面中,点击右侧的“添加规则(s)...”链接。选择“空白规则”开始创建新规则。
  5. 配置规则模式
    对于每个伪静态规则,你需要配置“匹配URL”的模式,这通常对应于<LookFor>标签中的内容。
  6. 设置重写操作
    接下来,配置“重写URL”部分,这对应于<SendTo>标签的内容。确保使用正确的语法和参数。
  7. 应用规则
    保存并应用每个规则。
  8. 测试规则
    完成所有规则的迁移后,通过浏览器访问你的网站,并确保每个伪静态URL都正确重写到对应的动态页面。

由于手动创建每个规则可能是一个繁琐的过程,你可以考虑编写一个脚本来自动执行这个过程,或者手动在IIS的URL重写模块中逐个设置规则。不过,请注意,IIS 7.5的URL重写语法和IIS6中的URLRewriter可能有所不同,因此可能需要调整规则以匹配新的语法。

请注意,这里给出的步骤是一个概述,具体的实现细节可能会根据你的具体需求和网站配置有所不同。确保在迁移过程中仔细测试每个规则,以确保它们按预期工作。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏