http-status-code-404 - ARR(负载平衡模式)仅显示 404
问题描述
前言:
我有 3 个带有 IIS 的 windows 2016 vm
- 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 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>
任何帮助将不胜感激
解决方案
因此,如果您在同一台服务器上设置了多个站点,则需要将 ARR 服务器主机标头添加到每个 Web 服务器主机标头中。ARR 似乎保留了原始请求的主机标头。
所以对于我的设置,我现在有以下内容。这解决了 404 错误
站点绑定 ARR 服务器
- arr.mytestapp.com
网络主机 1
- host1.mytestapp.internal
- arr.mytestapp.com
网络主机 2
- host2.mytestapp.internal
- arr.mytestapp.com
推荐阅读
- python-3.x - Selenium 无法正确加载 html - Python3.8
- javascript - 如何将UTC时间戳转换为另一个城市的当前时间?
- python - 在 for 循环中附加列表
- sql - ISNULL() 是否特定于整数?
- php - 如何在 SQL 或 PHP 中计算持续时间日期
- c - 如果修改了目标间接引用的数据,我应该声明指针的目标常量吗?
- dataframe - 如何将长纪元列从火花加载到弹性搜索作为时间格式?
- typescript - 以更 Typescript 的方式解决问题
- java - 如何在 Java 的 GridLayout 中设置特定组件的位置?
- c - 将数字转换为数组中的单词