我有两个进程/应用程序运行在端口8888和端口8890。
我可以通过http:// localhost:8888 & http:// localhost:8890访问我的windows服务器。
我目前使用IIS GUI来重写url。 应用程序请求路由(ARR)和URL重写已安装。
我已经成功地重写或redirect到服务器的所有请求到一个端口 – 本质上我映射“*”通配符到“ http:// localhost:8888 / {R:0}”,它工作时,我访问http:/ / /网站 !
我怎样才能扩展到以下场景:
http:// website / solution1 /应该redirect到端口8888& http:// website / solution2 /应该redirect到端口8890
请帮忙。
像这样的东西(在你的web.config)应该工作:
<rule name="solution1" stopProcessing="true"> <match url="^(solution1/)(.*)" /> <action type="Rewrite" url="http://localhost:8888/{R:2}" /> </rule> <rule name="solution2" stopProcessing="true"> <match url="^(solution2/)(.*)" /> <action type="Rewrite" url="http://localhost:8890/{R:2}" /> </rule>
IIRC, {R:0}将匹配整个URL,所以在这种情况下你不需要这个。 相反,与(和)你定义“捕获组”; {R:2}将是solution1/或solution2/之后的所有内容 。
如果您使用的是IIS GUI,我希望您能find需要填写的字段; 他们是你已经使用的相同的,只有不同的参数。