简体   繁体   English

在IIS 8中是否可以将文件夹重写到其他服务器上的子域?

[英]Is it possible in IIS 8 to rewrite a folder to a subdomain on a different server?

I am migrating an ASP.NET web site to Azure. 我正在将ASP.NET网站迁移到Azure。 Currently we have MovableType installed on the server that hosts our web site, and a /blog/ application in IIS that points to the files published by MovableType. 当前,我们在托管我们的网站的服务器上安装了MovableType,并在IIS中的/ blog /应用程序中指向了MovableType发布的文件。 In moving to Azure I would prefer to install MovableType on a server separate from our web site, but that means that our blog content will no longer reside on the same server as the main site. 在迁移到Azure时,我希望将MovableType安装在与我们的网站不同的服务器上,但这意味着我们的博客内容将不再与主站点位于同一服务器上。

If I setup a subdomain to point to the blog server is there a way to rewrite, for example, www.mysite.com/blog/post.html to blog.mysite.com/blog/post.html? 如果我设置了一个指向博客服务器的子域,是否可以重写一种方法,例如将www.mysite.com/blog/post.html重写为blog.mysite.com/blog/post.html?

I have tried the URL rewrite module, but it seems that it wants the rewritten Url to be on the same server. 我已经尝试了URL重写模块,但是似乎它希望重写的Url位于同一服务器上。 I have also tried HTTP redirects, but that changes the Url in the address bar. 我也尝试过HTTP重定向,但这会更改地址栏中的网址。

If this isn't possible with rewrites or redirection, what would be the best approach? 如果重写或重定向无法做到这一点,最好的方法是什么? Is mapping a drive from one Azure server to another a reliable option? 将驱动器从一台Azure服务器映射到另一台服务器是否可靠?

I was able to get this working using the URL Rewrite extension in IIS. 使用IIS中的URL重写扩展名,我可以使它工作。 The solution was to use the "Reverse Proxy" template. 解决方案是使用“反向代理”模板。 This template requires the installation of the Application Request Routing extension, but worked perfectly. 此模板需要安装“应用程序请求路由”扩展,但运行良好。

In case anyone else is trying to do this, here are my values for the key settings. 如果有人尝试这样做,这是我的关键设置值。

Match URL pattern: ^blog/(.*)
Rewrite URL: http://blog.mysite.com/blog/{R:1}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM