【问题标题】:Simple IIS rewrite outbound rule is giving an error and page crashes简单的 IIS 重写出站规则给出错误和页面崩溃
【发布时间】:2015-08-28 15:25:48
【问题描述】:

我尝试在某些网站已成功实施的 IIS 上使用 IIS 重写出站规则。

所以我创建了一个简单的规则,将单词“test”替换为“123456”。

我收到了这个错误

500 - 内部服务器错误。你的资源有问题 正在寻找,无法显示。

Web.config

<system.webServer>  
        <!--<urlCompression dynamicCompressionBeforeCache="false" />     -->
        <urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />

似乎如果我添加任何(只是任何)出站规则,网站就会崩溃。 我的意思是规则的模式没有影响,但规则本身就是一个条目。

有什么线索吗?

附注我应该安装 URL Rewrite Module 2.0 因为我好像安装了旧版本...它会解决问题吗?

附注我做了一些额外的更改,但它根本不起作用。

  1. 我用

  1. 我安装了此修复 rewrite_2.0_rtw_x64_KB2749660.msp(https://support.microsoft.com/en-us/kb/2749660“修复:在 IIS 7.0 或 IIS 7.5 的 URL 重写模块 2.0 中配置传出规则时响应已损坏”)

我也在这里问过这个问题https://forums.iis.net/t/1226401.aspx?Outbound+rule+is+giving+500+error+for+the+entire+website

【问题讨论】:

  • 查看这篇帖子 serverfault.com/questions/309713/… 的回复。压缩是出站规则问题的常见原因。尝试关闭动态压缩以确认。
  • 检查这个链接,我想你会得到回复forums.iis.net/t/1165899.aspx
  • @Kassav' 几天前我调查了这个链接。它没有帮助。想象一下,我禁用任何压缩,当我启用任何规则时,即使我尝试打开空的 *.html 页面,整个网站也无法正常工作。
  • 使用默认正则表达式的重写是否有效?
  • 500.52 表示您仍在压缩。我将把它留给你,因为我“没有任何解决方案”

标签: asp.net iis url-rewriting iis-7


【解决方案1】:

对于 outboundRules,请使用如下详细信息..

  1. 在运行网站的机器上,从命令行运行:

    reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0

    您可能需要使用 iisreset 跟进此操作

  2. 将以下内容添加到 web.config 文件的 system.webServer 部分的顶部,以禁用不受支持的静态压缩,同时保持动态不受损害;

&lt;urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" /&gt;
  1. 最后一步,可能不需要——但是!打开您的 IIS 管理控制台 - 单击顶层项目,从 IIS 部分打开“模块”组件。在右侧栏中,单击“查看有序列表...”并确保 RewriteModule 出现在 DynamicCompressionModule 下方的列表中。 供参考,您可以在此处查看 - http://codeblog.shawson.co.uk/iis7-urlrewrite-outbound-links-with-compression-enabled/

<rewrite>
  <rules>
    <rule name="InboundFriendlyAboutUs" stopProcessing="true">
      <match url="^about-our-car-finance$" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="page.aspx" />
    </rule>
  </rules>
  <outboundRules>
    <rule name="Outbound1" preCondition="IsHtml">
      <match filterByTags="A, Form" pattern="^(.*)About-Us\.aspx$"/>
      <action type="Rewrite" value="{R:1}about-our-car-finance"/>
    </rule>
    <preConditions>
      <preCondition name="IsHtml">
        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html"/>
      </preCondition>
    </preConditions>
  </outboundRules>
</rewrite>

【讨论】:

    猜你喜欢
    • 2013-06-13
    • 1970-01-01
    • 2021-08-22
    • 2017-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    • 1970-01-01
    相关资源
    最近更新 更多