IIS重写到本地应用程序 - 404失败
问题描述:
我想使用IIS8将流量从端口80/443路由到在同一台服务器上运行的两个应用程序 - 一个坐在端口8080上(node.js应用程序,作为单独的服务运行),另一个端口8090(一个.NET应用程序,在同一个IIS上运行,处理api调用)。IIS重写到本地应用程序 - 404失败
我已经安装上的端口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=""