本文介绍了问题托管在IIS7.5网站多ASP.Net MVC3应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些规格:


  • IIS 7.5

  • ASP.Net MVC3

我有三个MVC3应用程序,我想主持人:

I have three MVC3 applications I would like to host:


  1. 项目A

  2. 项目B

  3. 项目C

我想获得的URL是这样的,分别为:

I want to get the URLs to be like this, respectively:





  1. http://domain/
  2. http://domain/ProjectB
  3. http://domain/ProjectC

因此​​,在IIS中,我有默认的网站,它指向的项目A的文件夹。后来我加了两个应用它,一个指向项目B,一到项目C,并在硬盘上他们各自的文件夹。我存储的网站在C:\\网站。每个项目都有在C文件夹:应用程序的文件位于\\网站。正如你所看到的网站都没有嵌套在所有服务器上。

So in IIS, I have the default website, which points to the folder for ProjectA. I then added two Applications to it, one pointing to ProjectB, and one to ProjectC, and their respective folders on the hard drive. I am storing the sites in C:\sites. Each project has a folder in C:\sites where the application's files reside. As you can see, the sites are not nested at all on the server.

当我加载,它正试图从项目A web.config中加载的配置值。显然,这不是我想要的,我不是在服务器配置,真棒。我把它通过包装大部分项目A web.config中的位置标记,像这样的工作:

When I load http://domain/ProjectB, it is trying to load configuration values from the ProjectA web.config. Obviously this is not what I want, and I'm not that awesome at server configuration. I got it working by wrapping most of the ProjectA web.config in a location tag like so:

<location path="." inheritInChildApplications="false" >
    <!-- Lots of web.config stuff for ProjectA -->
</location>

我不是一个真正的这个迷,感觉不对的。对我来说,这似乎是在我的IIS站点嵌套应用程序应该甚至不知道父站点。我究竟做错了什么?我敢肯定,这是一些真正的小。我会作出项目A的应用程序,但我不希望它的别名,因为我想把它拉起来,为用户。

再次我不是知识渊博的有关服务器的东西,它只是不好玩我,所以为什么我问你们!

Again, I am not that knowledgeable about server stuff, it just isn't fun to me, hence why I'm asking y'all!

谢谢!

推荐答案

这是如何工作的。默认情况下,asp.net应用程序继承父母的web.config,你要么需要覆盖这些值在你的下web.config中或在inheritInChildApplications =false属性像上面一样包裹。

That is how it works. By default, asp.net applications inherit their parents web.config, and you either need to override those values in your lower web.config or wrap it in an inheritInChildApplications="false" attribute like you did above.

一个可能的选择是,如果你可以在网站不是一个asp.net应用程序的根目录下让你的主页。如果你不能,你坚持这样做。

One possible option is if you can make your home page at the root of the site NOT an asp.net application. If you can't, you're stuck doing this.

这篇关于问题托管在IIS7.5网站多ASP.Net MVC3应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 00:29