首页 文章

IIS重写到本地应用程序 - 404失败

提问于
浏览
0

我想使用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=""

1 回答

相关问题