SQL Server msdb stuck in the Single User Mode after Sitecore install

SQL Errors

Listing the errors below for good googling:


Error1:

Database 'msdb' is already open and can only have one user at a time.

Error2:

TITLE: Microsoft SQL Server Management Studio

------------------------------

Cannot display policy health state at the server level, because the user doesn’t have permission. Permission to access the msdb database is required for this feature to work correctly.

For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&LinkId=20476

------------------------------ BUTTONS: OK ------------------------------

I’ve seen this after installing Sitecore 10.1 on my local environment and I guess it was due to Sitecore install forgetting to remove the Single_user flag on the msdb after installation.

Solution

  1. admin cmd
  2. Open DAC with this command: sqlcmd -A
  3. ALTER DATABASE msdb SET MULTI_USER + Enter
  4. GO + Enter
  5. ALTER DATABASE model SET MULTI_USER + Enter
  6. GO + Enter

Have fun.

Sitecore Commerce 8.1 nonsence errors and fixes

A short blog post for you to get these nasty errors fixed.

Weird nonsence #1

-2146233343, Commerce Server Configuration, 
Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
SiteConfigReadOnly:Initialize

Resolve:

I have no idea what is this, but you need to add the following thing in your web config:

<system.web>
  	<trust level="Full" legacyCasModel="false"/>

Nonsence #2

Server Error in '/' Application.

-2147217843, Commerce Server Configuration, Login failed for user 'WORKGROUP\MY-PC$'. SiteConfigReadOnly:Initialize

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CommerceServer.Core.Runtime.CommerceException: -2147217843, Commerce Server Configuration, Login failed for user 'WORKGROUP\MY-PC$'. SiteConfigReadOnly:Initialize

etc, etc.

Resolve:

You might be running your website app pool using either Network Service or AppPoolIdentity, which is not enough for commerce. You need to set it to a user who has sysadmin and db_owner rights to the MSCS_Admin database – for example, your current administrator user identity.  S/O: link

I hope this helps

 

Sitecore Commerce 9 installation errors

During my latter installation of the Sitecore Commerce 9 with Robert Hock script, I had couple of errors that I wanted to share with you guys, to make sure it will eliminate numerous errors in the future.

So, here we go:

Error 1:

Install-SitecoreConfiguration : Cannot validate argument on parameter 'FilePath'. The " Test-Path $_ -PathType Leaf  " validation 
script for the argument with value 
"C:\inetpub\wwwroot\www.xyz.local\App_Config\Sitecore\ContentSearch\Sitecore.ContentSearch.config" did not return a result 
of True. Determine why the validation script failed, and then try the command again.
At D:\Commerce\SIF.Sitecore.Commerce.1.1.4\xyz Deploy-Sitecore-Commerce.ps1:200 char:5
+     Install-SitecoreConfiguration @params
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

Fix:

Check that the path to your config file is correct, and the file is there.

Error 2:

 Detailed Error Information: 
   
    Module&nbsp;&nbsp;&nbsp;IIS Web Core 
    Notification&nbsp;&nbsp;&nbsp;Unknown 
    Handler&nbsp;&nbsp;&nbsp;Not yet determined 
    Error Code&nbsp;&nbsp;&nbsp;0x8007000d 
    Config Error&nbsp;&nbsp;&nbsp; 
Config File&nbsp;&nbsp;&nbsp;\\?\C:\inetpub\wwwroot\xyz.commerce-identityserver\web.config 
    
    Requested URL&nbsp;&nbsp;&nbsp;https://identityserver.xyz.local:443/connect/token 
    Physical Path&nbsp;&nbsp;&nbsp; 
    Logon Method&nbsp;&nbsp;&nbsp;Not yet determined 
    Logon User&nbsp;&nbsp;&nbsp;Not yet determined 
     
    Config Source: 
       -1: 
    0: 
 
 More Information: 
  This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the 
event logs may contain more information about what caused this error. 
  View more information &raquo; 
   
 
 
At D:\Commerce\SIF.Sitecore.Commerce.1.1.4\Modules\InitializeCommerce\InitializeCommerce.psm1:89 char:17
+ ... $response = Invoke-RestMethod $UrlIdentityServerGetToken -Method Post ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Fix:

  1. Check that the URL rewrite module is present (from the Microsoft WPI)
  2. Check that all of your instances are running on the HTTPS
  3. Verify that .Net Core is installed (my case) –  https://www.microsoft.com/net/download

Error 3:

When you click on the Business Tools in the Launchpad it leads to the localhost:4200

Fix:

Go to: /sitecore/client/Applications/Launchpad/PageSettings/Buttons/Commerce/BusinessTools and set the Link field value to your bizfix server address (https://bizfx.xyz.local/ – in my case)

Error 4:

When you open your Business Tools in the Launchpad, you see the following error:

Failed to load https://commerce-authoring.xyz.local/api/GetNavigationView(): 
Response to preflight request doesn't pass access control check: 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'https://bizfx.xyz.local' is therefore not allowed access.

Fix:

Make sure that you have the correct bizfx url in the config.json of your commerce authoring:

\CommerceAuthoring_Sc9\wwwroot\config.json

In the AppSettings -> AllowedOrigins section, make sure that an entry to your BizFx’s URL is in the list!

By default it is localhost:4200, however, it can yield an error if you change it.

This setting is case-sensitive, means that if you have a https://MyBizFx.url, and you request it from https://mybizfx.url it won’t work, be careful.

The S/O post here answers this question as well.

Sitecore Prefetch configuration fails to load

Issue:

One day I was uprading my website to Sc 8.2 u2 and after all the steps were done, my sitecore couldn’t load, showing this exception:

[NullReferenceException: Object reference not set to an instance of an object.]
   Sitecore.Xml.Patch.XmlDomSource.get_NamespaceURI() +3
   Sitecore.Xml.Patch.XmlPatchHelper.MergeNodes(XmlNode target, IXmlElement patch, XmlPatchNamespaces ns) +118
   Sitecore.Configuration.ConfigPatcher.ApplyPatch(TextReader patch, String sourceName) +133
   Sitecore.Configuration.ConfigPatcher.ApplyPatch(String filename) +92
   Sitecore.Configuration.ConfigReader.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +176

[ConfigurationException: Could not load configuration file: \Website\App_Config\Include\Prefetch\Common.config.]
   Sitecore.Configuration.ConfigReader.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +379

[ConfigurationException: Could not scan configuration folder \Website\App_Config\Include\Prefetch for files.]
   Sitecore.Configuration.ConfigReader.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +581
   Sitecore.Configuration.ConfigReader.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +257

[ConfigurationException: Could not scan configuration folder \Website\App_Config\Include\Prefetch for files.]
   Sitecore.Configuration.ConfigReader.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +480

[ConfigurationException: Could not scan configuration folder \Website\App_Config\Include for files.]
   Sitecore.Configuration.ConfigReader.LoadAutoIncludeFiles(ConfigPatcher patcher, String folder) +581
   Sitecore.Configuration.ConfigReader.GetConfiguration() +655
   Sitecore.DependencyInjection.ServiceLocator.ConfigureServiceProvider() +29
   Sitecore.DependencyInjection.ServiceLocator.get_ServiceProvider() +153
   Sitecore.DependencyInjection.SitecorePerRequestScopeModule..ctor() +13

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +138
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +105
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1481
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +191
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +82
   System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +229
   System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1114
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +140
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +716

 

I was not able to understand what’s wrong! All of my prefetch configs were fine and identical to ones from the vanilla instance…

So, I started digging into the sitecore patching code. Everything seemed fine, I mean, it is solid and straightforward. I was hopeless, but then…

Solution:

I realized that my Prefetch folder has moved under the /Include folder!

\App_Config\Include\Prefetch\Common.config

And that caused the issue with incorrect patching!

So, in order to fix that, I just had to move it back to /Include, and it worked.

SwitchMasterToWeb exception

Hi folks,

This is yet another blogpost about an error you can get after enabling the SwitchMasterToWeb config in your sitecore (8.1).

The exception looks like that:

Could not find configuration node: contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster

 


Exception Details: System.InvalidOperationException: Could not find configuration node: contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster

Stack Trace: 
[InvalidOperationException: Could not find configuration node: contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster]
 Sitecore.Configuration.Factory.GetConfigNode(String xpath, Boolean assert) +483
 Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) +267
 Sitecore.Configuration.Factory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert) +137
 Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +109
 Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +1013
 Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +552
 Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +275
 Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +1013
 Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +552
 Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +275
 Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) +579
 Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration() +266
 Sitecore.ContentSearch.SolrProvider.SolrContentSearchManager.get_Cores() +92
 Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorSolrStartUp.Initialize() +44
 Website.Application.Application_Start(Object sender, EventArgs e) +11

This happens because the sitecore_list_index is referencing the syncMaster strategy while the default SwitchMasterToWeb config removes that strategy from configuration.

Solution: you should add the following patch to the SwitchMasterToWeb config in order to get rid of the list index on the delivery server:

 <index id="sitecore_list_index">
    <patch:delete/>
 </index>

 

What causes Tracker.Current initialization failure

Hi Folks,

Sometimes we may get this quite generic exception:

ERROR Application error.
Exception: System.InvalidOperationException
Message: Tracker.Current is not initialized
Source: Sitecore.Analytics
 at Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs args)
 at (Object , Object[] )
 at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
 at Sitecore.Analytics.Pipelines.StartAnalytics.StartAnalyticsPipeline.Run()
 at Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking.Process(RequestBeginArgs args)
 at (Object , Object[] )
 at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
 at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
 at Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I have created this blog post to summarize all the possible reasons of this exception in one single place.

#1 Analytics host name

Look up for the mismatch of the Analytics.HostName and site host name in your Sitecore.Analytics.Tracker.config

The Analytics.HostName setting value has to match your website hostname in SiteDefinition.config file.

#2 Cluster names (Thanks to @Jose Dominguez)

If you have a load balanced environment with multiple CDs, you each server must be configured to have a unique cluster name.

This is controlled by the Analytics.ClusterName setting in the Sitecore.Analytics.Tracker.config.

<setting name="Analytics.ClusterName" value="default-cd-cluster" />

A quote from the documentation

If you are creating a cluster of content delivery servers, use your domain name when naming the content delivery cluster.

For example: value="cluster1.domain.com"

Repeat this for each node in the cluster.

For a single content delivery server, use the domain name of the server instead.

#3 Contact Facet Factory error

This usually happens when your custom facet definitions are failing to initialize, some common reasons:

  1. Facet class does not fully/partially implement the facet interface

You may also see the below exception in your log files:

ERROR Cannot create tracker.
Exception: System.ArgumentException
Message: The specified type is not a valid facet type.
Parameter name: facetType
Source: Sitecore.Analytics.Model
 at Sitecore.Analytics.Model.Framework.ModelFactory.CreateFacet(Type facetType)
 at Sitecore.Analytics.Model.Framework.Faceted.AddFacet(String name, Type type)
 at Sitecore.Analytics.Model.Framework.ModelFactory.CreateContact(ID id, IReadOnlyDictionary`2 facets)
 at Sitecore.Analytics.Data.ContactFactory.Create(ID id)
 at Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbContactStorage.TryLoadContact(ID contactId, String identifier, IContactFactory factory, LeaseOwner leaseOwner, TimeSpan leaseDuration, Int32 maxAttempts)
 at Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbDataAdapterProvider.TryLoadContact(ID id, IContactFactory factory, LeaseOwner leaseOwner, TimeSpan leaseDuration)
 at Sitecore.Analytics.Data.ContactRepository.TryLoadContact(Guid id, LeaseOwner leaseOwner, TimeSpan leaseDuration)
 at Sitecore.Analytics.Tracking.ContactManager.TryLoadContact(Guid contactId, Int32 lockDurationMinutes, Boolean exclusive)
 at Sitecore.Analytics.Pipelines.EnsureSessionContext.LoadContact.Process(InitializeTrackerArgs args)
 at (Object , Object[] )
 at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
 at Sitecore.Analytics.Pipelines.EnsureSessionContext.EnsureSessionContextPipeline.Run(InitializeTrackerArgs args)
 at Sitecore.Analytics.DefaultTracker.EnsureSessionContext()
 at Sitecore.Analytics.Pipelines.CreateTracker.GetTracker.Process(CreateTrackerArgs args)
 at (Object , Object[] )
 at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
 at Sitecore.Analytics.Tracker.Initialize()

#4 WFFM Form is referencing a facet that can’t be initialized

This is essentially a subset of #3.

Check that your WFFM form and its save actions does not reference the unexisting contact facet! This happened to me when I eventually renamed facet, but forgot to update my form

More?

Please, feel free to comment this post and share some cases that you experienced, so that we could gather all of the related issues in one place.

Thanks

Fortis Exception: Value cannot be null. Parameter name: field

Hi Folks,

This is another common issue that I face on my local dev environment frequently when using Sitecore Fortis engine.
Sometimes you may get this kind of exception:

Value cannot be null.
Parameter name: field

Description: An unhandled exception occurred.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: field

Full stacktrace:

[ArgumentNullException: Value cannot be null.
Parameter name: field]
   Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName) +63
   Fortis.Model.Fields.FieldWrapper..ctor(Field field, ISpawnProvider spawnProvider) +37

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +329
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1499
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +191
   System.Activator.CreateInstance(Type type, Object[] args) +37
   Fortis.Model.ItemWrapper.GetField(String key, String lazyFieldsKey) +330

Solution: This usually happens when you rebuild your model, but forgot to publish your updated templates. Try to smart publish everything and it should start working.

Insert from template / Select Datasource dialogs hang up

tl;dr;  ->fix

I have found that sometimes my Select Rendering Datasource and Insert Item From Template (actually, all the insert item dialogs) start hanging after I expand a node.

You may observe the following exception in the log file as well:

ERROR Application error.
Exception: System.Xml.XmlException
Message: Root element is missing.
Source: System.Xml
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options)
at SolrNet.Impl.SolrQueryExecuter`1.Execute(ISolrQuery q, QueryOptions options)
at Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1.Execute(SolrCompositeQuery compositeQuery, Type resultType)
at Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1.Execute[TResult](SolrCompositeQuery compositeQuery)
at Sitecore.ContentSearch.Linq.QueryableExtensions.GetFacets[TSource](IQueryable`1 source)
at Sitecore.Buckets.Search.FacetSearcher.GetFacets(IQueryable`1 query, String startLocationItem, IProviderSearchContext context, Database database)
at Sitecore.Buckets.Pipelines.Search.GetFacets.RunFacets.Process(GetFacetsArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Buckets.Pipelines.Search.GetFacets.GetFacetsPipeline.Run(GetFacetsArgs args)
at ItemBuckets.Services.Search.d__c.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Fix: Check your SOLR server – it might be either down or unresponsive. Just restart it and everything will start working again.

Adjusting Wildcard Module for Sitecore 8+

Hi there,

If you ever decide to use Wildcard module on the Sitecore 8+ solution, you will find that wildcard rules editor doesn’t work as expected.

This happens because the Rules tree structure has been changed a bit since Sitecore 7.1. (read more)

Below you will find a set of steps to perform in order to re-enable the wildcard module for Sitecore 8.

1. Add new Wildcards Element under the  /sitecore/system/Settings/Rules/Definitions/Elements folder

2. Move every Action/Condition from /sitecore/system/Settings/Rules/Wildcards  subfolders to the Wildcards element created before. You can delete the old item if you want.
The result should look like this:

Screenshot 2016-08-30 16.10.46.png

3. Add a new Wildcards tag under /sitecore/system/Settings/Rules/Definitions/Tags

4. Navigate to the Wildcards tag configuration item  /sitecore/system/Settings/Rules/Definitions/Elements/Wildcards/Tags/Default and select the Wildcards tag from the list:

Screenshot 2016-08-30 17.07.02.png

 

5. Create a new Wildcards Rule Context Item under /sitecore/system/Settings/Rules

6. Select a Wildcards tag in the Tags list for the above created Rule context item:

Screenshot 2016-08-30 17.10.07.png

7. Finally, go to the /sitecore/templates/Wildcards/Route template and set /sitecore/system/Settings/Rules/Wildcards as Rules field datasource.

As a result, you can edit the wildcard rules as expected:

Screenshot 2016-08-30 17.12.21.png

We Rock!:)