K Khan
Aug 6, 2014
(0 votes)

Upgrade to EPiServer Commerce 7.10.1 (ECRP)

It was not a smooth upgrade for me, this blog is to share and summarize my experience. I have multiple issues especially in data migration and accessing Commerce e manager after upgrade.

Error in update-epidatabse

System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near 'MERGE'. You may need to set the compatibility level of the current database to a higher value to enable this feature.

Option 1: Error occurs If you are working in SQL Server 2012 database and it is runnning with compability level "SQL Server 2005". You can change the compability level for your database by rightclick on the database in SQL Server Managment Studio, select Properties, select Options and then there is a dropdown Compability Level.

Option 2:
1 – Export SQL Changes using package manager console PM>Export-EPiUpdates
2 - Console manager will show you a path
3 - Edit/Correct Script File 7.10.0.sql
4 - run update.bat in command mode, (Process is defined http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/75/Deployment/Updating-EPiServer-via-NuGet/)

Data Migration Issues:

Custom Blobs: We are using a custom blob provider to upload images on Cloudinary. Folder/File names are based on Blob ID. Images were not available after upgarde because probably probably Guids for same blob source have been updated and in result got 404. I will be thankful if EPiServer can investigate this further and recommend some solution. Further if this is case please avoid these type of conversions whereever possible. as it can be a big issue In Live Enviornments or if we have 2000 products asserts.
Fixe: Uploaded all images manually in CMS Edit mode.

Data Migration can fail due to any reason specific to your data. That needs a fix before upgrade but to fix it you need to know the issue that can be logged with below code. After upgrade Site will redirect to data migration screen every time it needs to turn off to fix the errors. After fixing the data issue, remove comments from the web.config and run the data migration again or you will not be able to login in Commerce Manager without upgrade.

How to turn off Migration screen:

Comment this line from web.config
<add name="MigrationInitializationModule" preCondition="managedHandler" type="EPiServer.Commerce.Internal.Migration.MigrationInitializationModule, EPiServer.Commerce.Internal.Migration" />

How to Log the data issues:

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Commerce.Catalog.Linking;
using EPiServer.Core;
using EPiServer.Framework;
using log4net;
using Mediachase.Commerce.Catalog;
using Mediachase.Commerce.Catalog.Objects;namespace EPiServer.Commerce.Sample
public class ErrorLoggerInitializationModule : IInitializableModule
private static readonly ILog _log = LogManager.GetLogger(typeof(ErrorLoggerInitializationModule));public void Initialize(Framework.Initialization.InitializationEngine context)
var referenceConverter = context.Locate.Advanced.GetInstance<ReferenceConverter>();
var contentLoader = context.Locate.Advanced.GetInstance<IContentLoader>();
var linksRepository = context.Locate.Advanced.GetInstance<ILinksRepository>();ValidateChildren(referenceConverter.GetRootLink(), contentLoader, linksRepository);
}private void ValidateChildren(ContentReference contentLink, IContentLoader contentLoader, ILinksRepository linksRepository)
IContent content;
if (!contentLoader.TryGet(contentLink, out content))
}foreach (var property in content.Property)
// Validates isNull for the property.
var isNull = property.IsNull;if (_log.IsInfoEnabled)
"Property '{0}' for content '{1}' with id '{2}' can check it's null value.", property.Name,
content.Name, content.ContentLink.ID);
catch (OutOfMemoryException)
catch (Exception exception)
if (_log.IsErrorEnabled)
"Property '{0}' for content '{1}' with id '{2}' contains the following error '{3}'.", property.Name,
content.Name, content.ContentLink.ID, exception.Message);
}var children = contentLoader.GetChildren<IContent>(contentLink);
foreach (var child in children)
ValidateChildren(child.ContentLink, contentLoader, linksRepository);
}if (content is NodeContent || content is EntryContentBase)
var links =
linksRepository.GetRelationsBySource(contentLink).OfType<ProductVariation>().Select(x => x.Target);
foreach (var linkReference in links)
ValidateChildren(linkReference, contentLoader, linksRepository);
}public void Preload(string[] parameters)
{}public void Uninitialize(Framework.Initialization.InitializationEngine context)

Other related resources on upgrade topics are



Aug 06, 2014


Aug 11, 2014 11:12 AM

Could you share the code you have for your blob provider? I made a simple test and didn't get any problems, but I probobly missed something.

K Khan
K Khan Aug 11, 2014 11:23 AM

Please check your email

K Khan
K Khan Aug 26, 2014 03:31 PM

Updates - We can't replicate the blob related issue.

Please login to comment.
Latest blogs
Fixing Optimizely Content Syncing/Caching Issues on the DXP pre CMS.Core 12.13.0

Hi all, With our recent deployments to the DXP for .NET 6 projects (one a new build and one an upgrade) our clients had raised issues where there...

Scott Reed | Mar 23, 2023

Handle hostnames, schedule jobs and role access when synchronizing content

The Environment Synchronizer module helps you to set your environment into a known state after synchronizing databases between environments. In thi...

Ove Lartelius | Mar 23, 2023 | Syndicated blog

4 tips and tricks for Hangfire on Optimizely CMS

Here are four useful tricks I always apply to any site where I use Hangfire (code included).

Stefan Holm Olsen | Mar 21, 2023 | Syndicated blog

The new LinkItem property in Optimizely CMS, and why it matters

In the past, we have used different tricks to achieve this. Now, the LinkItem property is finally built-in in Optimizely CMS 12!

Tomas Hensrud Gulla | Mar 20, 2023 | Syndicated blog

A day in the life of an Optimizely Developer - Vertical Slicing in CMS12

There is such a vast choice these days in how you can build a website, aside from all of the different programming languages out there, there are...

Graham Carr | Mar 20, 2023

Tag Helpers in CMS 12

Microsoft introduced the TagHelper back in the primordial soup of ASP.NET vNext which became .Net 5, then .NET Core then .Net 5 you know the drill…...

MartinOttosen | Mar 20, 2023