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: '/sitecore/shell/client/Sitecore/Speak/Ribbon/Controls/QuickbarButton/QuickbarButton.cshtml' .
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:
Comments