3

I've created a Coveo search page using the reference here: https://developers.coveo.com/display/public/SitecoreV4/Inserting+and+Customizing+a+Search+Interface+Component. When I try to preview it, I get the following error:

Error rendering the following component: Default

System.InvalidOperationException:
 Error while rendering view: '/Views/Coveo/SearchViewLayout.cshtml'.
 ---> System.Configuration.ConfigurationErrorsException: 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. 
(C:\Sitecore\dev.[obfuscated].org\Website\views\coveo\web.config line 6)
   at 
System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean 
ignoreLocal)
   at 
System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors
 schemaErrors)
   at 
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String 
configKey, Boolean getLkg, Boolean checkPermission, Boolean 
getRuntimeObject, Boolean requestIsHere, Object& result, Object&
 resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSection(String 
configKey)
   at System.Web.Configuration.RuntimeConfig.GetSectionObject(String 
sectionName)
   at System.Web.Configuration.RuntimeConfig.GetSection(String 
sectionName, Type type, ResultsIndex index)
   at System.Web.Configuration.RuntimeConfig.get_Compilation()
   at 
System.Web.Compilation.BuildManager.IsBatchEnabledForDirectory(VirtualPath
 virtualDir)
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath 
virtualPath)
   at 
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath
 virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean 
allowBuildInPrecompile, Boolean throwIfNotFound, Boolean 
ensureIsUpToDate)
   at 
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext
 context, VirtualPath virtualPath, Boolean noBuild, Boolean 
allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, 
Boolean ensureIsUpToDate)
   at 
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath
 virtualPath, HttpContext context, Boolean allowCrossApp, Boolean 
throwIfNotFound)
   at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath 
virtualPath)
   at 
Jabberwocky.Glass.Autofac.Mvc.Pipelines.Processors.GetModelFromViewProcessor.GetModel(GetModelArgs
 args, String path)
   at 
Jabberwocky.Glass.Autofac.Mvc.Pipelines.Processors.GetModelFromViewProcessor.Run(GetModelArgs
 args)
   at 
Jabberwocky.Glass.Autofac.Pipelines.Processors.ProcessorBase`1.Process(T
 pipelineArgs)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String 
pipelineName, TArgs args)
   at 
Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs,TResult](String
 pipelineName, TArgs args, Func`2 resultGetter)
   at Sitecore.Mvc.Presentation.Rendering.GetModel()
   at Sitecore.Mvc.Presentation.Rendering.get_Model()
   at 
Sitecore.Mvc.Extensions.ObjectExtensions.ValueOrDefault[T,TResult](T 
source, Func`2 resultGetter)
   at Sitecore.Mvc.Presentation.ViewRenderer.get_Model()
   at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
   --- End of inner exception stack trace ---
   at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
   at 
Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer
 renderer, TextWriter writer, RenderRenderingArgs args)
   at 
AOPA.Library.CustomSitecore.Pipelines.RenderRenderings.ExecuteRenderer.Render(Renderer
 renderer, TextWriter writer, RenderRenderingArgs args) in 
c:\Dev\AOPA\web2.0\src\AOPA.Library\CustomSitecore\Pipelines\RenderRenderings\ExecuteRenderer.cs:line
 18

Other items appear correctly in Preview mode. In the logs, there is no additional information; same error. It looks like I have this section in multiple files in the following locations:

Views
Views\Coveo
Views\Coveo Hive
sitecore\shell\client
layouts\Coveo Hive
Coveo\Hive\templates
Areas\Social\Views
Areas\Aopa\Views
Areas\Admin\Views

I do not have a Razor sectionGroup in my main web.config. I would rather not provide the web.config because it has sensitive data in it.

I've tried adding <remove name="system.web.webPages.razor"/> before the sectionGroup definition but that does nothing.

Views/Web.config

    <?xml version="1.0" encoding="utf-8"?>

    <configuration>
      <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
          <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
      </configSections>

      <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
          <namespaces>
            <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.Optimization" />
          </namespaces>
        </pages>
      </system.web.webPages.razor>

      <appSettings>
        <add key="webpages:Enabled" value="false" />
      </appSettings>

      <system.webServer>
        <handlers>
          <remove name="BlockViewHandler" />
          <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
        </handlers>
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="MiniProfiler" publicKeyToken="b44f9351044011a3" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.2.0.157" newVersion="3.2.0.157" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Practices.ServiceLocation" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Http.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.4.6.0" newVersion="1.4.6.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="AngleSharp" publicKeyToken="e83494dcdc6d31ea" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-0.9.4.42449" newVersion="0.9.4.42449" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>

    </configuration>

Views/Coveo/Web.config

<configuration>
  <configSections>
    <remove name="system.web.webPages.razor"/>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>

  <system.web>
    <httpHandlers>
      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
    </httpHandlers>

    <!--
        Enabling request validation in view pages would cause validation to occur
        after the input has already been processed by the controller. By default
        MVC performs request validation before a controller processes the input.
        To change this behavior apply the ValidateInputAttribute to a
        controller or action.
    -->
    <pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
    </pages>
  </system.web>

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />

    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>
</configuration>

1 Answer 1

1

Coveo for Sitecore 4.1 came with Web.configs that referenced System.Web.WebPages.Razor V2.0.0. My project uses 3.0.0. I had to update the version in the following files to 3.0.0:

Views/Coveo/Web.config
Views/Coveo Hive/Web.config
layouts/Coveo Hive
Coveo/Hive/templates

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.