IIS 10-如何基于端口

时间:2019-10-10 15:34:49

标签: url iis

我为同一VM创建了两个域名。例如。 http://app1.domain.com http://app2.domain.com

当前两者都指向端口80,应用程序运行正常。 我的要求如下:

  1. 当我打开http://app1.domain.com时,它应该在端口80(默认端口)上打开应用程序。
  2. 当我选择http://app2.domain.com时,它应该在端口90上打开另一个应用程序。

我该怎么做?我尝试了网址重写/重定向,但无法使其正常工作。我是IIS功能的新手。有人可以帮忙提供任何示例/屏幕截​​图吗?

1 个答案:

答案 0 :(得分:0)

您可以使用bwlo URL重写规则:

 <rule name="rule1" enabled="true" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^app1.domain.com$" />
                </conditions>
                <action type="Redirect" url="http://localhost:80" />
            </rule>
            <rule name="rule2" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^app2.domain.com$" />
                </conditions>
                <action type="Redirect" url="http://localhost:90" />
            </rule>

enter image description here

enter image description here