首页 > 解决方案 > Dotnet Core MVC 重写反向代理工作但现在 404.4

问题描述

我有一个托管在 Azure 上的 Dotnet Core MVC 应用程序。

有三个重写规则将代理内容从另一个网站反向到应用程序。

自从我上次部署以来,这在 Azure 上出现了问题,并且在我的本地开发环境中也出现了问题。

我假设已经有补丁或更新,就好像我遍历我的代码并重置为较旧的提交一样,反向代理规则仍然不起作用,但它们之前确实如此。

我已将我的应用程序交换回之前的部署槽,它现在可以工作,但我无法发布任何更改。

这是我的网络配置:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout">
        <environmentVariables />
      </aspNetCore>
      <rewrite>
        <rules>
          <rule name="ProxyTrees" stopProcessing="true">
            <match url="^trees/(.*)" />
            <action type="Rewrite" url="http://x/trees/{R:1}" />
          </rule>
          <rule name="ProxyNurseries" stopProcessing="true">
            <match url="^nurseries/(.*)" />
            <action type="Rewrite" url="http://x/nurseries/{R:1}" />
          </rule>
          <rule name="ProxyCashAndCarry" stopProcessing="true">
            <match url="^cash-and-carry/(.*)" />
            <action type="Rewrite" url="http://x/cash-and-carry/{R:1}" />
          </rule>
        </rules>
      </rewrite>
    </system.webServer>
  </location>
</configuration>

现在,当我访问 /trees /nurseries 或 /cash-and-carry 时,我收到错误 404.4

“您要查找的资源没有与之关联的处理程序。”

我真的很难过,因为通常有一个代码更改会导致这样的问题,但我真的找不到任何东西。

帮助表示赞赏!

标签: .netiis.net-core

解决方案


推荐阅读