IIS反向代理 [英] IIS Reverse Proxy

查看:522
本文介绍了IIS反向代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个网站。

XX.XX.XX.XXX:5917这是一个web表单网站

XX.XX.XX.XXX:5917 which is a webforms website

XX.XX.XX.XXX:5916这是一个MVC的网站。

XX.XX.XX.XXX:5916 which is an mvc website.

在同一IIS 7的服务器上的两个网站。我可以浏览各个网站,登录等。

Both websites on the same IIS 7 server. I can navigate each website, login, etc.

但是,当用户进入XX.XX.XX.XXX:5917/Report欲从XX.XX.XX.XXX:5916/Report内容送达,但链接直接保持XX.XX .XX.XXX:5917 /报告

However, when a user goes to XX.XX.XX.XXX:5917/Report I want the content from XX.XX.XX.XXX:5916/Report to be served up, but the url to remain XX.XX.XX.XXX:5917/Report.

要做到这一点,我试图建立在5917点的反向代理,从5916担任了内容。

To do this, I'm trying to set up a reverse proxy on the 5917 site to serve up content from 5916.

当我有一个适当的重定向规则,我可以点击在5917到报告的链接,它会带我去5916 /报告。这工作,但改变地址栏。当我使用重写规则选项,绝对没有什么明显的反应。如果我搞砸了在动作支架年底网址后,页面会破裂,所以我知道它至少​​评估规则。

When I have a redirect rule in place, I can click a link in 5917 to Reports and it will take me to 5916/Reports. This works, but changes the address bar. When I use the Rewrite rule option, absolutely nothing discernible happens. If I screw up the end url in the action bracket then the page will break, so I know it's at least evaluating the rule.

下面是工作重定向规则:

Here is the 'working' redirect rule:

<rule name="Reverse Proxy to Reports" stopProcessing="true">
    <match url="\bReport\b" />
    <action type="Redirect" url="http://XX.XX.XX.XXX:5916/{R:0}" />
</rule>

我缺少什么?我在哪里何去何从?

Am I missing anything? Where do I go from here?

推荐答案

试着在你的 XX.XX.XX.XXX:5917 的WebForms 的web.config :

Try adding this on your XX.XX.XX.XXX:5917 WebForms web.config:

<system.webServer>
    ...
    <rewrite>
        ...
        <rules>
            <rule name="ReverseProxyInboundRuleForReports" stopProcessing="true">
                <match url="(Report/.*)" />
                <action type="Rewrite" url="http://localhost:5916/{R:1}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

您可能需要在IIS应用程序请求路由扩展为它工作,虽然。如果是这样,那么你可以从这个链接得到它:

You might need 'Application Request Routing' extension on IIS for it to work though. If so then you can get it from this link:

http://www.iis.net/downloads/microsoft/application-请求路由

您也可以阅读更多关于此链接技术:

You can also read more about the technique on this link:

http://weblogs.asp.net/owscott/creating-a-reverse-proxy-with-url-rewrite-for-iis

祝你好运!

这篇关于IIS反向代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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