首页 > 解决方案 > ARR(负载平衡模式)仅显示 404

问题描述

前言:

我有 3 个带有 IIS 的 windows 2016 vm

  1. IIS04 - ARR 服务器 (arr.mytestapp.com)
  2. IIS10 - 第一个负载平衡目标 (host1.mytestapp.internal)
  3. IIS11 - 第二个负载平衡目标 (host2.mytestapp.internal)

从 ARR 服务器,我可以浏览到两个主机(应用程序加载)

对于农场设置,我添加了两个服务器和这个 URL 测试

http://arr.mytestapp.com/status.aspx
Response Match = [Online]

哪些测试成功 - 两台服务器都通过

问题

当我浏览到 arr url 时,它给了我“HTTP 错误 404。找不到请求的资源”

我启用了失败的请求跟踪规则,但看不到很多明显错误的地方。重写规则使用农场的名称......不确定这是否是一个问题

 <EventData>
  <Data Name="ContextId">{80000015-0001-FF00-B63F-84710C7967BB}</Data>
  <Data Name="Substitution">http://mytestapp.website/{R:0}</Data>
  <Data Name="RewriteURL">http://mytestapp.website/favicon.ico</Data>
  <Data Name="AppendQueryString">true</Data>
  <Data Name="LogRewrittenURL">false</Data>
 </EventData>
     
<EventData>
    <Data Name="ContextId">{80000015-0001-FF00-B63F-84710C7967BB}</Data>
    <Data Name="OldUrl">http://mytestapp.website/favicon.ico</Data>
    <Data Name="NewUrl">/favicon.ico</Data>
</EventData>

我猜这与我的 URL 重写规则有关……但我很难过。

<rule name="ARR_mytestapp.website" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
    <match url="*" />
    <action type="Rewrite" url="http://mytestapp.website/{R:0}" />
    <conditions>
       <add input="{HTTP_HOST}" pattern="*.mytestapp.com" />
       <add input="{HTTP_HOST}" pattern="api.mytestapp.com" negate="true" />
    </conditions>
</rule>

任何帮助将不胜感激

标签: http-status-code-404iis-10url-rewrite-modulearr

解决方案


因此,如果您在同一台服务器上设置了多个站点,则需要将 ARR 服务器主机标头添加到每个 Web 服务器主机标头中。ARR 似乎保留了原始请求的主机标头。

所以对于我的设置,我现在有以下内容。这解决了 404 错误

站点绑定 ARR 服务器

  • arr.mytestapp.com

网络主机 1

  • host1.mytestapp.internal
  • arr.mytestapp.com

网络主机 2

  • host2.mytestapp.internal
  • arr.mytestapp.com

推荐阅读