在IIS 7.5上运行同一个端口上两个网站? [英] Run two web sites on same port on IIS 7.5?

查看:544
本文介绍了在IIS 7.5上运行同一个端口上两个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要能够在同一内部网服务器和端口号运行一个ASP.net web应用程序的两个版本,但有一个映射到/与其它映射到/实验(未真实姓名,但足够接近) 。

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 (not real names, but close enough).

C:\\的Inetpub \\ wwwroot的\\版本1 => http://test1.organization.com/
C:\\的Inetpub \\ wwwroot的\\版本2 => http://test1.organization.com/experimental

C:\inetpub\wwwroot\Version1 => http://test1.organization.com/ C:\inetpub\wwwroot\Version2 => http://test1.organization.com/experimental

第一个URL已经被暴露于一些测试用户,因此,需要保持一定程度的稳定。第二个将包含实验code,只有用户去/实验就会看到。我们没有使用不同的服务器或不同的端口选项。

The first URL has already been exposed to some beta users and therefore needs to be kept somewhat stable. The second will contain experimental code that only users going to /experimental will see. We don't have the option of using a different server or a different port.

我通过让/映射到IIS下的站点一个站点,然后添加第二个站点,因为它下面的应用程序,它混叠/ SITE2在过去做到了这一点。

I've achieved this in the past by having / mapped to a site under Sites in IIS, then adding the second site as an application underneath it, and aliasing it to /site2.

服务器
    网站
        默认Web站点< =物理路径映射到第一个版本和/
             /应用1<映射到第二个版本=嵌套应用和/实验

Server Sites Default Web Site <= physical path mapped to first version and / / Application1 <= nested application mapped to second version and /experimental

不过,这似乎马虎。难道是吸尘器重写规则或ARR做到这一点?如果是这样,怎么样?

However, this seems sloppy. Would it be cleaner to do this with a rewrite rule or with ARR? If so, how?

谢谢!

推荐答案

ARR的组合和重写规则将很好地解决这个问题。下面是要遵循的步骤:

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


  1. 下载并安装ARR <一个href=\"http://www.iis.net/download/ApplicationRequestRouting\">http://www.iis.net/download/ApplicationRequestRouting

  2. 在IIS管理器,在连接窗格中选择您的机器,在IIS部分中双击应用程序请求路由功能,点击在操作的服务器代理链接面板,然后勾选启用代理服务器复选框,选择满足了应用的操作。

  3. 改变你的两个现有网站的绑定 - 例如,绑定发布网站的端口81和实验网站,端口82

  4. 创建一个新的网站和程序池,并将其绑定的http:*:80。将它命名为默认Web站点。点它的物理路径的%SystemDrive%\\的Inetpub \\ DefaultWebSite

  5. 创建了默认网站的web.config文件,写你的路由规则有:

  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 apppool, and bind it "http:*:80:". Name it "Default Web Site". Point it's 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>


  • 您可能必须与您的重写规则有些不甘示弱,你可以尝试使用IIS上的URL重写模块的小程序,并阅读更多关于它在这里:<一href=\"http://learn.iis.net/page.aspx/500/testing-rewrite-rule-patterns/\">http://learn.iis.net/page.aspx/500/testing-rewrite-rule-patterns/如需更多帮助确保浏览鲁斯兰Yakushev的博客: http://ruslany.net/

  • 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/

    这会给你三个完全独立的网站,通过通俗易懂端口80上的一个门面(当然你可以在端口81和82直接打到每个网站,如果你需要:的http://本地主机:81 / Default.aspx的例如:

    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.

    这篇关于在IIS 7.5上运行同一个端口上两个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆