【问题标题】:IIS rewrite to local apps - fails with 404IIS 重写到本地应用程序 - 失败并出现 404
【发布时间】:2017-03-05 18:56:05
【问题描述】:

我想使用 IIS8 将流量从端口 80/443 路由到运行在同一台服务器上的两个应用程序 - 一个位于端口 8080(node.js 应用程序,作为单独的服务运行),另一个位于端口 8090(一个 . NET 应用程序,在同一个 IIS 上运行,处理 api 调用)。

我已经在端口 80 上设置了一个应用程序,使用以下 web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
        <rewrite>
              <rules>
                <rule name="rewrite api to backend calls" stopProcessing="true">
                    <match url="^api/(.+)$"/>
                    <action type="Rewrite" url="http://127.0.0.1:8080/{R:1}"/>
                 </rule>
                <rule name="rewrite everything else to frontend" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://127.0.0.1:8090/{R:1}"/>
                </rule>             
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

不幸的是,这种方法不起作用 - 无论我尝试查询什么资源,都会收到 404 错误。

在 FREB 日志中,请求被正确地从 OldUrl 转换为 NewUrl,在缓存中没有找到任何内容,然后在日志中提到以下内容为 MODULE_SET_RESPONSE_ERROR_STATUS

ModuleName="IIS Web Core", Notification="MAP_REQUEST_HANDLER", HttpStatus="404", HttpReason="Not Found", HttpSubStatus="4", ErrorCode="The filename, directory name, or volume label syntax is incorrect.
 (0x8007007b)", ConfigExceptionInfo=""

【问题讨论】:

    标签: iis iis-8


    【解决方案1】:

    必须根据IIS Rewrite not working (but redirection does) 主题启用应用程序请求路由中的代理。问题解决了:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-01
      • 2021-11-21
      • 2020-12-06
      • 2014-05-06
      • 1970-01-01
      • 2020-07-27
      • 2011-12-28
      • 1970-01-01
      相关资源
      最近更新 更多