Orchard 1.8 Configuration Error

Topics: Core
Apr 2, 2014 at 7:17 AM
Edited Apr 2, 2014 at 7:21 AM
Hi, when I download the Orchard 1.8 source code and run with Visual Studio 2013 Ultimate, I met the following error. Did found some history post regarding to the error, but still don't have a clue how to resolve it. Thanks for any clue.

Before I installed Visual Studio 2013, I uninstalled Visual Studio 2012 and 2013 express for web. That will not be a problem since, I can successfully run ASP.MVC 5 project with 2013 Ultimate.

Configuration Error

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.

Source Error:
Line 3:  
Line 4:      <configSections>
Line 5:          <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
Line 6:              <remove name="host"/>
Line 7:              <remove name="pages"/>
Source File: E:\Orchard.WeInfo\src\Orchard.Web\web.config Line: 5
Apr 2, 2014 at 7:31 AM
Edited Apr 2, 2014 at 7:40 AM
When I comment out the sectiongroup tag, the problem seems gone, but I am not sure whether this will lead into other problems.
        <!--<sectiongroup name="system.web.webpages.razor" type="system.web.webpages.razor.configuration.razorwebsectiongroup, system.web.webpages.razor, version=, 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=, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false"/>
            <section name="pages" type="system.web.webpages.razor.configuration.razorpagessection, system.web.webpages.razor, version=, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false"/>
However, when I run the orchard command line I met the following error.
Initializing Orchard session. (This might take a few seconds...)
  Unrecognized configuration section system.web.webPages.razor. (E:\Orchard.WeIn
fo\src\Orchard.Web\web.config line 19)
  Unrecognized configuration section system.web.webPages.razor. (E:\Orchard.WeIn
fo\src\Orchard.Web\web.config line 19)
Which I think is the system.web.webPages.razor tag at line 19 causes the problem.
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
                <add namespace="System.Collections.Generic"/>
                <add namespace="System.Linq"/>
                <add namespace="System.Web.Mvc"/>
                <add namespace="System.Web.Mvc.Ajax"/>
                <add namespace="System.Web.Mvc.Html"/>
                <add namespace="System.Web.Routing"/>
                <add namespace="System.Web.WebPages"/>
                <add namespace="Orchard.Mvc.Html"/>
Apr 2, 2014 at 12:16 PM
Hi, I experienced the same problem. The code for 1.7.x ran fine but when I switched to 1.x (1.8) brach, compiled it and run it I got the same message.

The solution in my case was simple. I deleted the content of the %userprofile%\documents\iisexpress\config\ directory. The VS will recreate it, but I made a backup anyway. I think it tried to run on old version of asp.net, the iis express was misconfigured by prev version or something like that.
Apr 5, 2014 at 3:48 AM
Hi janchvojka, thanks for your method. I reinstalled my VM this time. But I will have some clues when I run into this error next time. A big help for me to understand why.
Apr 5, 2014 at 2:28 PM
Edited Apr 5, 2014 at 2:32 PM
Removing all Orchard Sites from %userprofile%\documents\iisexpress\config\applicationhost.config (and recreating the virtual dir from the Orchard.Web Web properties in Visual Studio) did the trick for me to.