MVC3 main web application interferes with MVC3 child web application

Just some background information here. I am currently using shared hosting with WinHost and have the following setup

Shared IIS |______Main Primary MVC3 web app (uses NHibernate & Castle.Windsor for ORM) |_______ Child MVC3 web app (not using NHibernate nor Castle.Windsor as it does not need database access) 

In WinHost, this allows me to set the starting point of the application, so I can have

 / <= for primary app /child <= for the child app 

Each application has its own web.config, so it looks like

 /web.config /child/web.config 

Well, to my surprise, it seems that even if the / child folder is set as the starting point of the application, it does not seem to be isolated from the main main web application, because when I try to download a child application, I get a notorious error

Failed to load file or assembly "Castle.Windsor" or one of its dependencies. The system cannot find the specified file.

I tried a workaround by dumping the library associated with NHibernate to the / child / bin folder, but this only worsens the matter because I will also need to configure additional NHibernate configuration in the child application, although the child application does not need database access.

So, is there somewhere (e.g. web.config) that I can forcibly isolate the child application from the parent application?

I think the last resort would be to cut out the child web application and turn it in the β€œArea” into the main main web application, but this is not ideal, because these two web applications are not connected to each other for all intended for different audiences etc.

Note: this should not be a routing problem for two reasons 1. WinHost sets the / child folder as the starting point of the application 2. In the main web application, I already ignored the child inside RegisterRoutes ()

 routes.IgnoreRoute("child"); routes.IgnoreRoute("{folder}/{*pathinfo}", new { folder = "child" }); 

Well, after 3 hours of working on this, I am at a loss. Any suggestions are welcome. Let me know if you need to see any configs. Thank you in advance!

+7
source share
2 answers

I decided to solve this by changing the child application in Area under the parent application. Then I disabled the start point of the application for the / child folder and deleted the / child folder from the server.

Now it works, although I'm not too excited about a workaround.

+1
source

The problem is inheriting .config. But you can disable this using the <location> element:

 <location path="." inheritInChildApplications="false"> <system.web> ... </system.web> </location> 

Thus, basically you should look in your configuration for everything that is typical for the parent application, but not used in it, and disable its inheritance.

Here is an article with more information: http://www.colincochrane.com/post/2007/11/Disabling-Configuration-Inheritance-For-ASPNET-Child-Applications.aspx

+1
source

All Articles