IIS URL重定向有效,但重写会引发403禁止错误

时间:2014-11-17 11:38:57

标签: asp.net iis

我在IIS应用程序的子目录中有一个web.config文件,如

<configuration>
  <system.webServer>
      <rewrite>         
          <rules>
            <rule name="Proxy2" stopProcessing="true" patternSyntax="Wildcard">
                <match url="*"  ignoreCase="true"/>
                    <conditions>
                      <add input="{HTTP_HOST}" pattern="*" />
                  </conditions>
                <action type="Rewrite" url="http://anotherurl.com/{R:0}" />
            </rule> 
        </rules>
      </rewrite>
  </system.webServer>
</configuration>

所以,如果我浏览https://www.abc.com/subdir,它将返回403禁止错误。但如果我将操作更改为重定向,它将重定向没有问题。我应该找什么来找到问题?

1 个答案:

答案 0 :(得分:2)

无法重写到其他网址(或其他应用程序池)。在这种情况下,只有重定向才有效。

编辑:从技术上讲,它是可能的,但不是你实现它的方式。如果要重写到另一个URL,则需要使用IIS中的Application Request Routing (ARR)模块作为反向代理实现。

相关问题