Sitecore Experience Commerce – XC9 – Troubleshooting your installation

The installation of Sitecore Experience Commerce is a fairly easy process, but if you are new to it, you may end up with few installation issues. This blog aims to provide some workarounds and fixes if you encounter these errors.

This post assumes that you are installing Sitecore Experience Commerce 9 initial release on Sitecore 9 update 1

Error: The service cannot accept control messages at this time.

If you see this error message, you can either wait few minutes or do and ‘iisreset’  and start the installation process again. This error message happens temporarily from time to time if IIS is busy in starting or stopping operations.

Error: Get Token From Sitecore.IdentityServer – The remote server returned an error 500

If during the installation process you get the ‘Get Token From Sitecore.IdentityServer’ failed 500 error like below, then this error means that Server Identity has not been able to contact the SQL server and is throwing a 500 error exception. The most probable reason is that you will have multiple SQL server instances running on your machine and the correct value for the “Server:MACHINE-NAME\SQLEXPRESS” has not been passed through the scripts.

Install-SitecoreConfiguration : The remote server returned an error: (500) Internal Server Error.
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.1.0\Public\Install-SitecoreConfiguration.ps1:253 char:21
+                     & $entry.Task.Command @paramSet | Out-Default
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
   + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

 

There are 2 options to fix this:

Option 1 (During installation process)

To fix it if you have already started the installation process, open the following configuration JSON files and update the connection string SQL Server instance name manually to Server:”MACHINE\\SQLEXPRESS2016″, in some files you have to do it at 2 places:

1-\SitecoreIdentityServer\wwwroot\appsettings.json
2-\CommerceShops_Sc9\wwwroot\bootstrap\Global.json
3-\CommerceOps_Sc9\wwwroot\bootstrap\Global.json
4-\CommerceMinions_Sc9\wwwroot\bootstrap\Global.json
5-\CommerceAuthoring_Sc9\wwwroot\bootstrap\Global.json
6-\CommerceShops_Sc9\wwwroot\data\Environments\Plugin.SQL.PolicySet-1.0.0.json
7-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.Habitat.CommerceAuthoring-1.0.0.json
8-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.AdventureWorks.CommerceAuthoring-1.0.0.json

Once you have made these changes, please do an iisreset before running the script again from PowerShell.

If you have already come to this step you may want to update the

SIF.Sitecore.Commerce.1.0.1748\Configuration\Commerce\Master_SingleServer.json

file by removing the Tasks that have already been installed. For example you may want to remove the tasks till ImportRootCertificate and run the script again to just initialize commerce and bootstrap your environment.

Option 2 (Before starting the installation process)

If you are planning to install XC9 with multiple instances of SQL servers running locally on your machine, then you may want to do this prior to the installation: (assuming the SQL server you are referring to can be accessed at “MACHINE\\SQLEXPRESS2016” or something similar

1- Unzip the Sitecore.Commerce.Engine.2.0.1922.zip file

2-Navigate to \Sitecore.Commerce.Engine.2.0.1922\wwwroot\bootstrap\Global.json

3-Update the Server value on line 48 and line 97 to match your SQL server instance name

4-Zip the folder again in a way that it doesn’t create any sub-folder and path \Sitecore.Commerce.Engine.2.0.1922.zip\wwwroot\bootstrap\Global.json exists, otherwise you will get an error again.

5-Place it back in the deploy folder

6-Unzip the Sitecore.IdentityServer.1.0.65.zip file

7-Navigate to Sitecore.IdentityServer.1.0.65\wwwroot\appsettings.json file

8-Update the value of SQL Server to match your SQL server instance name

9-Zip the folder contents again ensuring that it doesn’t create any sub-folders and path to Sitecore.IdentityServer.1.0.65.zip\wwwroot\appsettings.json exists

10-Place it back in the deploy folder

Run the script again and it should run without any issues. It will take approximately 50 minutes to do the installation.

This is a known deployment bug and it has been raised this with Sitecore with reference number 36299. This has also been raised on community forum 

Update March 2018: The above error is now fixed in Sitecore Commerce 9 – update 1

Error:HTTP Error 500.19

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

If you get this error, it meas that ASP.NET Core module is not installed correctly on you machine. You can download from here and read more about it from here

Error:HTTP Error 502.5

PS>TerminatingError(Invoke-RestMethod): " IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681 "
>> TerminatingError(Invoke-RestMethod): " IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681 "
Install-SitecoreConfiguration : IIS 502.5 Error HTTP Error 
502.5 - Process Failure Common causes of this issue: The application process 
failed to start The application process started but then stopped The application process 
started but failed to listen on the configured port Troubleshooting steps: 
 Check the system event log for error messages Enable logging the application process' stdout 
messages Attach a debugger to the application process and inspect For more information 
visit: https://go.microsoft.com/fwlink/?LinkID=808681 
At C:\Program 
Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.0.2\Public\Install-SitecoreConfiguration.ps1:253 char:21
+ & $entry.Task.Command @paramSet | Out-Default
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
 + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
Install-SitecoreConfiguration : IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue: The application process
failed to start The application process started but then stopped The application process started but failed to listen on the configured port Troubleshooting steps:
 Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect For more information
visit: https://go.microsoft.com/fwlink/?LinkID=808681
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\1.0.2\Public\Install-SitecoreConfiguration.ps1:253 char:21
+ & $entry.Task.Command @paramSet | Out-Default
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
 + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration


This error is also related to incorrect SQL server values (as mentioned above) double check them in the configuration json files and do an iisreset:

1-\SitecoreIdentityServer\wwwroot\appsettings.json
2-\CommerceShops_Sc9\wwwroot\bootstrap\Global.json
3-\CommerceOps_Sc9\wwwroot\bootstrap\Global.json
4-\CommerceMinions_Sc9\wwwroot\bootstrap\Global.json
5-\CommerceAuthoring_Sc9\wwwroot\bootstrap\Global.json
6-\CommerceShops_Sc9\wwwroot\data\Environments\Plugin.SQL.PolicySet-1.0.0.json
7-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.Habitat.CommerceAuthoring-1.0.0.json
8-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.AdventureWorks.CommerceAuthoring-1.0.0.json

Error: InitiazlieHabitatCommerceServices 502.3 – Bad Gateway error

Initializing Shops: https://localhost:5005/commerceops/InitializeEnvironment(environment='HabitatShops')
PS>TerminatingError(Invoke-RestMethod): " 

IIS 10.0 Detailed Error - 502.3 - Bad Gateway 
  HTTP Error 502.3 - Bad Gateway 
  The specified CGI application encountered an error and the server terminated the process. 
 Most likely causes: 
   	The CGI application did not return a valid set of HTTP errors. 	A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.  
 Things you can try: 
   	Use DebugDiag to troubleshoot the CGI application. 	Determine if a proxy or gateway is responsible for this error.  
 Detailed Error Information: 
    Module   AspNetCoreModule 
    Notification   ExecuteRequestHandler 
    Handler   aspNetCore 
    Error Code   0x80072ee2 
     
  

This error is also related to incorrect SQL server values (as mentioned above) in the configuration json files:

1-\SitecoreIdentityServer\wwwroot\appsettings.json
2-\CommerceShops_Sc9\wwwroot\bootstrap\Global.json
3-\CommerceOps_Sc9\wwwroot\bootstrap\Global.json
4-\CommerceMinions_Sc9\wwwroot\bootstrap\Global.json
5-\CommerceAuthoring_Sc9\wwwroot\bootstrap\Global.json
6-\CommerceShops_Sc9\wwwroot\data\Environments\Plugin.SQL.PolicySet-1.0.0.json
7-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.Habitat.CommerceAuthoring-1.0.0.json
8-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.AdventureWorks.CommerceAuthoring-1.0.0.json

Error: Message=Arithmetic operation resulted in an overflow

ERROR SQL:block:findentity.Error: Message=Arithmetic operation resulted in an overflow..|Trace= v System.Data.ProviderBase.TimeoutTimer.StartMillisecondsTimeout(Int64 milliseconds)
v System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
v System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
v System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
v System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
v System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
v System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
v System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
v System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
v System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()

This error is also related to incorrect SQL server values in the configuration json files:

1-\SitecoreIdentityServer\wwwroot\appsettings.json
2-\CommerceShops_Sc9\wwwroot\bootstrap\Global.json
3-\CommerceOps_Sc9\wwwroot\bootstrap\Global.json
4-\CommerceMinions_Sc9\wwwroot\bootstrap\Global.json
5-\CommerceAuthoring_Sc9\wwwroot\bootstrap\Global.json
6-\CommerceShops_Sc9\wwwroot\data\Environments\Plugin.SQL.PolicySet-1.0.0.json
7-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.Habitat.CommerceAuthoring-1.0.0.json
8-\CommerceShops_Sc9\wwwroot\data\Environments\PlugIn.AdventureWorks.CommerceAuthoring-1.0.0.json

 Error: sxa.storefront.com is visible in experience editor but not as the published site

If you have used a different HostName value in your installation script then ‘sxa.storefront.com‘ like ‘sitecore901.commerce‘ and wondering why this is not coming up after you have published the webiste multiple times then you need to do the following:

1-Open content editor

2-Navigate to ‘/sitecore/content/Sitecore/Storefront/Settings/Site Grouping/Storefront‘ item

3-Update the value for Host Name field to your host header and publish again

I hope this post will be helpful to you guys while you are installing Sitecore Experience Commerce, any comments/feedback is welcome.

 

Thanks

Naveed

Reference:

https://www.linkedin.com/pulse/installing-sitecore-xc-90-kautilya-prasad

Advertisements

Sitecore Experience Commerce – XC9 – The Uninstall Script

Sitecore Experience Commerce is the new offering from Sitecore in the commerce arena and it is getting lot of attraction. This blog presents a PowerShell script to help out developers during the uninstall process.

I have posted a reference installation script that I have used during installation, (originally taken from the documentation and then added actual version for the packages) so you can always refer to it and compare it with your own script.

It may happen that during your installation, you have entered an incorrect value for a parameter or path to one of the packages. Then you may want to uninstall the the module before you can re-install it again.  Or may be you just want to uninstall the XC9 module to start from scratch. The process of uninstalling XC9 module can be difficult to do manually, so I present a a simple PowerShell script to automate it!

All you need to do is update the Param values (between line 3 and 15) to suit your installation variables and then run from the PS console:

Copy it locally in the deploy folder and run it like .\uninstall-commerce.ps1

All the script is doing is un-installing the SolrIndexes, IIS websites, website physical files and databases.

If you want to completely uninstall Sitecore 9 update 1 version, then use this script

Enjoy!

Naveed

Getting Started with Sitecore and Microsoft Azure Apps – Part 2 – Deploying through ARM templates

In previous blog, I have shown one-click deployment of Sitecore on Microsoft Azure. In this blog, we will explore the topics of Azure Resource Management (ARM) templates and Sitecore Azure Toolkit to do our Microsoft Azure deployments.

Before we begin!

What are ARM templates anyway ?

If you have not heard about them before, you are not the only one.

Simply put, they are JSON files where you can define the structure and configuration values (just like web.config file but in json format) of what you want to deploy. For more information about ARM templates, please visit Microsoft documentation.

Sitecore Azure Toolkit streamlines your Microsoft Azure deployments using ARM templates and gives you out of the box integrations for Microsoft Application Insights, Microsoft Azure Redis Cache and Microsoft Azure Search. This toolkit is a great starting point if you are at beginner level.

Pre-requisites

In order to do Sitecore deployments, there are some prerequisites that you will need to install on your machine as mentioned in the documentation.

As of today, you will need the following tools and packages:

Once you have installed the tools and downloaded pre-built Web Deploy packages, you can follow the step by step guide below and do a Sitecore Azure PaaS deployment for XP1 configuration:

Step 1: Upload Web Deploy packages

The first step will be to upload the Web Deploy packages at a location which can be accessed over the internet during our installation process. Microsoft Azure provides storage accounts to store any kind of data that can be accessed over internet. Create a new storage account within the Azure portal using this guide  and then upload the individual server role scwdp.zip packages. I am using Sitecore 8.2 up-3 and for XP1 configurations so I have uploaded the following packages:

  • Sitecore 8.2 rev. 170407_cd.scwdp.zip
  • Sitecore 8.2 rev. 170407_cd.scwdp.zip
  • Sitecore 8.2 rev. 170407_prc.scwdp.zip
  • Sitecore 8.2 rev. 170407_rep.scwdp.zip

Once you have uploaded the packages, open ‘Microsoft Azure Storage Explorer’ and connect to your account. Generate a shared access signature URL for each of the packages and note it down for later use as shown below:

 

For example, one of the shared access URL will look like this

https://sitecorewdp.blob.core.windows.net/sitecorewdp/Sitecore%208.2%20rev.%20170407_prc.scwdp.zip?st=2017-05-04T05%3A28%3A00Z&se=2017-05-05T05%3A28%3A00Z&sp=rl&sv=2016-05-31&sr=b&sig=QWdz%2BAwz%2BAPVuwj7EC0kEZsL4BMl3mkZIOigNjicOAY%3D

At the end, you should have 4 web deploy packages URL.

Step 2: Setup MongoDB collections for analytics

The next step will be to setup MongoDB for the deployment. You can either provision a new VM through Microsoft Azure and install MongoDB and then create your databases or you can use 500 MB of FREE MongoDB storage provided by mlab.com.

If you have never used mlab for Sitecore before, please follow this guide  by Sitecore MVP David Peterson to create 4 individual MongoDB for your site. 

Step 3: Update azure.parameters.json

Once you have noted down shared access URLs for web deploy packages and also got connection strings for MongoDBs, the next task is to update the azure.parameters.json file.

Assuming that you have downloaded the Sitecore Azure Quick Start ARM templates from GitHub , navigate to the ‘xp’ folder and update the azure.parameters.json file with the parameters that you have recorded earlier.

You can leave licenseXml value as blank as it will be passed through the command line.

Step 4: Setup Sitecore Azure Toolkit folder

I downloaded the Sitecore Azure Toolkit zip package and copied to a location C:\azure\sitecore-azure on my local machine. Then I copied the Sitecore license file and the ‘xp‘ folder that I modified in the previous step in the same folder location. This will make sure that I do not make any path related errors while I am running the PowerShell commands

Step 5: Run PowerShell Commands

Okay, the moment of truth has arrived.

Open PowerShell in administrative mode and navigate to the Sitecore Azure Toolkit folder. In my case it will be ‘C:\azure\sitecore-azure‘ and then run the following 2 commands to setup PowerShell:

  • Add-AzureRMAccount – this will show a pop-up to login to your Azure account
  • Import-Module .\tools\Sitecore.Cloud.Cmdlets.psm1 -verbose – this will load the Sitecore specific Azure commands into the session.

 

Now we are ready to provision our environment with just one command. If you have followed the steps as above and have entered values in your parameters.json, just entered the following command:

Start-SitecoreAzureDeployment -location ‘East US’ -Name ‘SitecoreAzureXP1DeploymentMay2017’ -ArmTemplatePath ‘.\xp\azuredeploy.json’ -ArmParametersPath ‘.\xp\azuredeploy.parameters.json’ -LicenseXmlPath ‘.\license.xml’ -SetKeyValue @{}

This will show a message that deployment has started:

Then you can go and make yourself a cup of coffee as you have to wait for another 15-20 minutes before the deployment will be completed and you see a success message.

Navigate to to your dashboard portal and you should see all of your services running for the deployment!

I

Video

I think the topic is complicated enough and a simple video can give a better overview:

 

 

Overview of XP1 Architecture

When you deploy Sitecore with XP1 configuration using quick start templates and Sitecore Azure Toolkit, you get the following services:

  • CM App Service Plan & CM Web App
  • CD App Service Plan & CD Web App
  • Reporting App Service Plan & Reporting Web App
  • Processing App Service Plan & Processing Web App
  • SQL Server with Core, Master and Reporting DB
  • SQL Server with Web DB
  • Application Insights (used for logging exceptions and much more)
  • Azure Search
  • Redis Cache

In order to understand it better, you can see the following topology diagram.

 

That’s it, Sitecore Azure Toolkit really makes it easy to do customized your Microsoft Azure PaaS deployments. It is a great tool and you should really check it out!

Thanks

Naveed.

 

Getting Started with Sitecore and Microst Azure Apps – Part 1 – One-Click Azure PaaS Deployment

Sitecore Web Content Management System (WCMS) has recently release a version which supports deploying Sitecore WCMS as Platform as a Service (PaaS). As a passionate Sitecore technologist, this is great news and I am pretty excited about it.

Pieter Brinkman from Sitecore has done a great job explaining the benefits of using Microsoft Azure Web Apps and I think in few years from now, everyone will be using Microsoft Azure as their preferred hosting option.

In this post, I will post a short video screen cast of showing how easy it is to take advantage of this new offering from Sitecore and get an instance of Sitecore up and running in few minutes.

So if you never looked into Microsoft Azure web apps or didn’t get time to do it yourself, this video is for you.

 

Once the deployment is finished, you will see the following services within the resource group:

  • CM App Service Plan & CM Web App
  • CD App Service Plan & CD Web App
  • SQL Server with Core and Master DB
  • SQL Server with Web DB
  • Application Insights (used for logging exceptions and much more)
  • Azure Search
  • Redis Cache

In technical Sitecore terms, this is called XM1 configuration, where Sitecore is deployed in CMS-only mode. You can use this deployment if you are not planning to use analytics and marketing features of Sitecore. An overview of this deployment topology is shown below:

In the next post, I will show how can we use ARM Templates, Sitecore Azure Toolkit and PowerShell to do Sitecore deployments on Microsoft Azure. The ARM templates provides more flexibility and control over the deployment topology.

Stay tuned.

Thanks

Naveed