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)
At WinHost, it allows me to set the application starting point, so I can have
/ <= for primary app
/child <= for the child app
Each app has its own web.config, so it is like
/web.config
/child/web.config
Well, to my surprise, it seems that even though /child folder is set as an application starting point, it doesn't appear to be isolated from the parent primary web app, because when I try to load the child app, I get the infamous error
Could not load file or assembly 'Castle.Windsor' or one of its dependencies. The system cannot find the file specified.
I tried the workaround by dumping NHibernate related library into /child/bin folder, but that only makes matter worse, because I would also need to setup additional NHibernate configuration within the child app, even though child app has no need for database access.
So is there a setting somewhere (such as web.config) that I can force child app to be isolated from the parent app?
I think that the last resort would be to ditch the child web app, and turn that into an "Area" under primary main web app, but that's not ideal, because these two web apps aren't related to each other at all, targeting different audience etc.
Note: it should not a case of routing issue, because of two reasons 1. WinHost sets the /child folder as application starting point 2. Under the primary web app, 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 greatly appreciated. Let me know if you need to see any configs. Thank you in advance!
I ended up resolving this by modifying the child app into an Area under the parent app. I then disabled application starting point for /child folder and removed the /child folder from server.
It is now working, although I am not entirely too excited about the workaround.
The issue is .config inheritance. But you can disable that using the <location>
element:
<location path="." inheritInChildApplications="false">
<system.web>
...
</system.web>
</location>
So basically you would have to look in your config for anything that is specific to the parent app but not used in the child, and turn off it's inheritance.
Here is an article with some more information: http://www.colincochrane.com/post/2007/11/Disabling-Configuration-Inheritance-For-ASPNET-Child-Applications.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With