简体   繁体   English

将应用程序路径添加到IIS中的网站时出现问题

[英]issue with application paths when adding it to a website in IIS

I have a website in IIS7 wish i've added an application to it my problem reside in the application paths when I try to click on a link in the application it's always redirect me to the default page of the website even though when I open the application alone without merging it every path work right so we were obligated to change every path of the application for them to work fine . 我在IIS7中有一个网站希望我已经添加了一个应用程序,当我尝试点击应用程序中的链接时,我的问题就存在于应用程序路径中它总是将我重定向到网站的默认页面,即使我打开了单独使用应用程序而不将其合并到每个路径工作正确,因此我们有义务更改应用程序的每个路径,以使它们正常工作。 my question is : 我的问题是:

  1. Is adding an application to a website the best solution for merging two websites ? 是否在网站上添加应用程序是合并两个网站的最佳解决方案?
  2. Is there any other way that don't actually need to change all the application paths ? 有没有其他方法实际上不需要更改所有应用程序路径?

About first question 关于第一个问题

If you would like to host 2 application on one IIS you have two choices: 如果您想在一个IIS上托管2个应用程序,您有两个选择:

  1. Add application to website (as you did) - this option is good if your webconfigs are 100% compatible, because root webconfig will also change settings in child application 将应用程序添加到网站(正如您所做) - 如果您的webconfig 100%兼容,此选项很好,因为root webconfig也会更改子应用程序中的设置
  2. Create Reverse proxy - it is much safer because both asp.net applications are completely separate. 创建反向代理 - 它更安全,因为两个asp.net应用程序是完全分开的。 You can look on this setup tutorial http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing ) 您可以查看此安装教程http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing

About second question 关于第二个问题

If you decide to use child application, unfortunately you do not have any other option to "rewrite" all your links in your code. 如果您决定使用子应用程序,很遗憾您没有任何其他选项来“重写”代码中的所有链接。 My suggestion is to create a function which will automatically add prefix to external links, and store base link for other site it configuration. 我的建议是创建一个函数,它会自动为外部链接添加前缀,并为其配置的其他站点存储基本链接。 I did such project with success. 我成功完成了这样的项目。

If you decide to use reverse proxy and have "easy" separate links, you could setup reverse proxy to do work for you. 如果您决定使用反向代理并拥有“简单”的单独链接,则可以设置反向代理以便为您工作。 For example all links started with "A" goes to application 1, rest to application 2. You could write really complicate rules, using regular expressions. 例如,以“A”开头的所有链接都转到应用程序1,其余部分转到应用程序2.您可以使用正则表达式编写非常复杂的规则。

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

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