2017-03-31 129 views
1

我在我的DMZ中运行反向代理(RP)服务器(Win 2012 R2)。然后连接到运行Win 2008 R2的LAN服务器。我在另一个Win 2012 R2 LAN盒子前也有相同的RP服务器。500 URL重写模块错误ASP.NET Core

我们正在局域网背后的RP上部署我们的第一个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> 

就赢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和文本。

任何见解?

+0

任何变化剃刀页没有复制到生产服务器?试图获得剃须刀页面时遇到的任何错误? –

回答

1

我看到你在规则中有Response Response。如果响应被压缩,这可能会导致RP服务器中的URLRewrite模块发生500错误。您可以通过检查子状态码来查看详细信息。 gzip的编码,这是正常500.52。你可以在RP服务器的IIS日志看到这个

更多细节上substatuscode iis status code

如果错误是500.52,检查this

+0

你太棒了!谢谢。 – 206mph