【发布时间】:2017-03-31 22:25:59
【问题描述】:
我正在我的 DMZ 中运行反向代理 (RP) 服务器 (Win 2012 R2)。然后连接到我运行 Win 2008 R2 的 LAN 服务器。我在另一个 Win 2012 R2 LAN 盒子前面也有相同的 RP 服务器。
我们正在 RP 后面的 LAN 上部署我们的第一个 ASP.NET Core 应用程序。它完美运行的是 LAN 盒子是 Win 2012 R2。但是,如果我们将应用程序移动到我们的生产 Win 2008 R2 机器上,它会工作,除非有一个控制器返回 HTML 视图(而不是 XML 或 JSON)。同样,完全相同的代码适用于 Win 2012 R2 LAN 机器,但不适用于 Win 2008 R2 LAN 机器。
这是 RP web.config(除了 IP 和域之外,两个 LAN 服务器都相同)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://10.0.0.254/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="^http(s)?://10.0.0.254/(.*)" />
<action type="Rewrite" value="http{R:1}://our-public-domain.com/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
在 Win 2008 R2 LAN 框中,这是 web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\MyApp.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 5x8x39x8-580x-4xx2-955x-76x4x4685415-->
正如我所说,连接到 Win 2012 R2 或 Win 2008 R2 机器时在同一 RP 服务器上的配置。此外,我们在 Window 2008 R2 上还有其他不使用 ASP.NET Core 的站点,这些站点运行良好,但没有一个站点具有视图,因为它们只返回 XML、JSON 和文本。
有什么见解吗?
【问题讨论】:
-
是否有任何更改剃须刀页面未复制到生产服务器?尝试获取剃须刀页面时遇到任何错误?
标签: asp.net-core reverse-proxy iis-8