问题描述
序言:
我有 3 个带有 IIS 的 Windows 2016 虚拟机
- IIS04 - ARR 服务器 (arr.mytestapp.com)
- IIS10 - 第一个负载平衡目标 (host1.mytestapp.internal)
- IIS11 - 第二个负载平衡目标 (host2.mytestapp.internal)
从 ARR 服务器,我可以浏览到两个主机(应用加载)
对于农场设置,我添加了服务器和此 URL 测试
http://arr.mytestapp.com/status.aspx
Response Match = [Online]
哪个测试成功 - 两台服务器都通过
问题
当我浏览到 arr 网址时,它给了我“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>
任何帮助将不胜感激
解决方法
因此,如果您在同一台服务器上设置了多个站点,则需要将 ARR 服务器主机标头添加到每个 Web 服务器主机标头中。看来ARR保留了原始请求的主机头。
所以对于我的设置,我现在有以下内容。这解决了 404 错误
网站绑定 ARR 服务器
- arr.mytestapp.com
虚拟主机 1
- host1.mytestapp.internal
- arr.mytestapp.com
虚拟主机 2
- host2.mytestapp.internal
- arr.mytestapp.com