Saturday, February 02, 2019

Sitecore Error Troubleshooting: Experience Editor and Preview mode Error- Rendering view QuickbarButton.cshtml

Error Details: [InvalidOperationException]: Error while rendering view: '/sitecore/shell/client/Sitecore/Speak/Ribbon/Controls/QuickbarButton/QuickbarButton.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').

The one of the feature of Sitecore is to support multisite using single instance of Sitecore and for this we can utilize the Sitecore patch file to setup the new site:

      <site name="BrandA"
    rootPath="/sitecore/content/Tenant/BrandA"
    startItem="/Home"
    hostName=www.BrandA.com />
      <site name="BrandB"
          rootPath="/sitecore/content/Tenant/BrandB"
          startItem="/Home"
        hostName="www.BrandB.com"/>

Recently I was working on a Sitecore 9.1 project where we need to convert single site implementation into multiple managed websites, so I requested one of the team member to perform this task.
After setting up the BrandB website, we started getting error in Sitecore Experience Editor and Preview mode while accessing the page from BrandB:- Ribbon was not loading and Sitecore loading screen was in active mode only:

BrandB Site Patch file:


Error Analysis: To verify this issue,

1. I checked the log file:

And found [InvalidOperationException]: Error while rendering view: &#39;/sitecore/shell/client/Sitecore/Speak/Ribbon/Controls/QuickbarButton/QuickbarButton.cshtml&#39; .

2. BrandA site was working fine.

3. Removed the Site patch file and SiteB started working fine, in this case it was taking the default website setting. <site name=”website”….> is the default setting that comes with Sitecore.

Cause of Error:
Again, I investigated the BrandB patch file and found that Preview.DefaultSite setting was pointing to BrandA and due to this Ribbon was not loading in Experience Editor and Preview mode.

In multisite configuration, the value of Rendering.SiteResolving value set as “true” at /App_Config/Sitecore.config which helps in site resolving, so cross-site links can be rendered with correct hostname, language, and virtual folder.

In my case, the Experience Editor and Preview mode are being opened in the context of the site defined in the Preview.DefaultSite setting i.e. SiteA, due to this unexpected error “Server Error in '/' Application.” was coming in the place of Ribbon.

Solution:
To resolve this issue, I changed the Site name to SiteB in Preview.DefaultSite setting and now site context site resolved successfully and started loading the Ribbon correctly in Experience Editor and Preview mode.

Useful articles:


Share:

0 comments:

Sitecore® Technology MVP 2019

Featured Post

Sitecore-Front-end performance tuning points

In the previous Sitecore Performance Tuning article, i tried to explain about that Sitecore website performance depends upon Front-end ...

Total Pageviews

State Counter

Popular

About Me

My photo
Based in Bangalore, INDIA, Amit is a Sitecore MVP and MCC. He has an MCA from the U.P.T.U., INDIA and holds certifications including Sitecore and SharePoint 2007/2010. He is an contributor to Sitecore/MSDN communities and http://amitkumarmca04.blogspot.com/. Amit have experience in Sitecore, ASP.Net with C#, MVC, SharePoint, Classic ASP, VB,Macros,HTML,JavaScript,JSON,BootStrap and AngularJS.

Followers

Follow me on Twitter