I’m having trouble with this as well. Has anyone actually got Orchard running successfully in a sub directory?
Here’s my setup:
Site.com <-- ASP.NET MVC 3 app running on .NET 4
Site.com/blog <-- Orchard 1.5.1
I have tried making /blog a virtual directory and also an application in IIS, both yield the same errors which appear to be related to the inheritance of web.config files.
Here’s what happens:
1. Firstly, you will get 500 error in the browser with no actual error message and nothing reported in the log – not very helpful. I opened up IIS Manager UI and tried to open the
application configuration, and discovered the following error:
There was an error while performing this operation.
Filename: \\?\C:\[path] \MyBlog\web.config
Line number: 13
Error: There is a duplicate 'system.web.webPages.razor/host' section defined
2. At this point I tried to <remove> the sections and allow the child web.config (ie the Orchard web.config) to re-define them. This kind of gets you past the initial error…
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<remove name="host" />
<remove name="pages" />
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
Now IIS Manager is now happy to open the file, however...
3. If you try and browse to the site you’ll get an ASP.NET error (at least there is an error message now):
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Section or group name 'system.web.webPages.razor' is already defined. Updates to this may only occur at the configuration level where it is defined.
Line 10: <configuration>
Line 11: <configSections>
Line 12: <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
Line 13: <remove name="host"/>
Line 14: <remove name="pages"/>
So, while the IIS Manager UI seems ok with using <remove> for <configSections>, ASP.NET is not. This behavior seems to be verified by this bug on Connect:
https://connect.microsoft.com/VisualStudio/feedback/details/434335/asp-net-mvc-web-config-configsections-inheritance-problem. This bug is pretty old, but I assume the information in there is still valid.
So, now we’re left in a situation where we need to isolate our child app’s configuration, but we can’t do it because inheritance for configSections doesn’t work properly.
Also, it’s worth nothing that when you search for info about child app config file isolation, the general guidance is to wrap the parents <system.web> section under <location> section to scope the inheritance like this:
<location path =”.” inheritInChildApplications="false">
The problem is that you can’t wrap a <configSections> under a <location>, so you’re stuck.
This seems like a pretty straightforward scenario: I have an existing ASP.NET app, I want to install Orchard under a sub directory and use it for a blog. Has anyone managed to get this scenario to work?