[英]IIS Rewrite to a new port - Different IIS version, different results
A server (x.com) has the following parameters: 服务器(x.com)具有以下参数:
- It is accessible from the outside from port 80. -可从端口80从外部访问。
- It has an internal service running on port 1000. -它具有在端口1000上运行的内部服务。
- The service needs to be accessible from a subdomain (service.x.com) -需要从子域(service.x.com)访问该服务
Running IIS on Windows 10, I did the following: 在Windows 10上运行IIS,我做了以下事情:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="URL Rewrite" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://localhost:1000/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
And it worked beautifully. 而且效果很好。
The same code, on the other end, run on Windows Server 2012 R2 yields this: 另一方面,在Windows Server 2012 R2上运行的同一代码将产生以下结果:
HTTP Error 404.4 - Not Found HTTP错误404.4-找不到
The resource you are looking for does not have a handler associated with it. 您要查找的资源没有与之关联的处理程序。
Module IIS Web Core IIS Web核心模块
Notification MapRequestHandler 通知MapRequestHandler
Handler ExtensionlessUrlHandler-Integrated-4.0 处理程序ExtensionlessUrlHandler-Integrated-4.0
Error Code 0x8007007b 错误代码0x8007007b
I do not understand why it works on one version of IIS and not on the other one. 我不明白为什么它可以在一个版本的IIS上而不在另一个版本上工作。
I found: ARR (Application Request Routing) needs to be enable. 我发现:需要启用ARR(应用程序请求路由)。
Of course, this is not mentioned anywhere in any of the error messages nor in log. 当然,在任何错误消息或日志中都没有提到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.