Run two web sites on same port on IIS 7.5?

前端 未结 2 1794
心在旅途
心在旅途 2021-02-05 16:10

We need to be able to run two versions of one ASP.net web application on the same intranet server and port number, but with one mapped to / and the other mapped to /experimental

相关标签:
2条回答
  • 2021-02-05 16:20

    A combination of ARR and rewrite rules will solve this nicely. Here are the steps to follow:

    1. Download and install ARR http://www.iis.net/download/ApplicationRequestRouting
    2. In IIS Manager, select your machine in the Connections pane, double-click the Application Request Routing feature in the IIS section, click on the "Server Proxy" link in the Actions pane, then check the "Enable proxy" checkbox and choos the Apply action.
    3. Change the bindings of your two existing websites, for instance, bind the Released website to port 81, and the Experimental website to port 82.
    4. Create a new website and app pool, and bind it to http:*:80:. Name it "Default Web Site". Point its physical path to "%SystemDrive%\inetpub\DefaultWebSite"
    5. Create a web.config file for the "Default" website, and write your routing rules there:

      <rules>
          <rule name="Reverse Proxy for Experimental" stopProcessing="true">
              <match url="^.*/experimental/.*" />
              <action type="Rewrite" url="http://{HTTP_HOST}:82/{R:0}" />
          </rule>
          <rule name="Reverse Proxy for Release" stopProcessing="true">
              <match url=".*" />
              <action type="Rewrite" url="http://{HTTP_HOST}:81/{R:0}" />
          </rule>
      </rules>
      
    6. You may have to fiddle somewhat with your rewrite rules, you can experiment using the URL Rewrite Module applet on IIS, and read more about it here: http://learn.iis.net/page.aspx/500/testing-rewrite-rule-patterns/ For further help be sure and browse Ruslan Yakushev's blog: http://ruslany.net/

    This will give you three completely separate websites, accessibly through a single facade on port 80 (though of course you can hit each website directly on port 81 and 82 if you need to: http://localhost:81/default.aspx, for example).

    0 讨论(0)
  • 2021-02-05 16:41

    Can you run one of the sites at a different subdomain, say test1.organization.com and beta1.organization.com? If so then you can set them both up as top-level websites in IIS and set the Host Name on each Site Binding so they can both run on the same IP address and port.

    0 讨论(0)
提交回复
热议问题