Error loading page in CMS



I'm currently working on a site running EPiServer CMS 7 and Commerce 1 R3.

In this site there is a main menu which loads top level category nodes from the commerce catalog as main menu items. It uses the URL from the node's SEO tab as the URL for each menu item.
Whenever you click on a menu item the EcfCatalogHandler picks up the URL and a custom display template for the category is loaded which is defined in Commerce (Catalog Management->Templates).
This all seems to be working ok, except when the page is loaded in edit/preview mode in the CMS.
So whenever I open the CMS edit mode, and in the menu of the homepage for example I click on a menu item, the page (display template) is loaded and a episerver popup appears which says "Unable to connect to the web server. What would you like to do?".

When examining this in the browsers network page I see that the CMS is sending a GET request to 'http://someurl.local/episerver/shell/Stores/context/?url=http%3A%2F%2Fsomeurl.local%2FHuren.aspx&epiworkspaceactive=true&dojo.preventCache=1454508091125' which then returns a 404 status code.

The log gives me this:

System.Web.HttpException (0x80004005): Not found: http://someurl.local/Huren.aspx
  at EPiServer.Shell.UI.Rest.ContextStore.NotFound(Uri uri)
  at EPiServer.Shell.UI.Rest.ContextStore.QueryForUrl(Uri url)
  at lambda_method(Closure , ControllerBase , Object[] )
  at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
  at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.b__10()
  at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
  at EPiServer.Shell.Services.Rest.RestControllerBase.ExecuteCore()
  at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
  at EPiServer.Shell.Services.Rest.RestHttpHandler.ProcessRequest(HttpContextBase httpContext)
  at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Does anyone have any suggestions?

Thanks in advance.



Feb 03, 2016 15:09

Might help to check url in admin for the site under -manage websites. I got some weird problems when previewing sites that had wrong urls there.

Feb 03, 2016 15:49

Thanks for your suggestion, the URL seems to be what it should be so I don't think that is the problem.

I've decompiled the EPiServer.Shell.UI.Rest.dll assembly and looked up the ContextStore.QueryForUrl method.
And it seems there is no IUriContextResolver that can resolve the URL (I think).
See the decompiled code here:

private RestResult QueryForUrl(Uri url)
	foreach (IUrlContextResolver current in this._urlResolvers)
		ClientContextBase data;
		if (current.TryResolveUrl(url, out data))
			return base.Rest(data);
	return ContextStore.NotFound(url);


Edited, Feb 04, 2016 9:04

I don think proper edit mode support form commerce was introduced until 7.5.

Feb 04, 2016 11:44

I see,

I've done a small experiment by creating a Context resolver.
This seems to get rid of the popup box and the call to context store now returns 200 ok status code.

I've created the context resolver as described here:

public class CommercePageContextResolver : IUrlContextResolver
    public bool TryResolveUrl(Uri url, out ClientContextBase instance)
        instance = ResolveUrl(url);
        return instance != null;

    private ClientContextBase ResolveUrl(Uri url)
        StaticCatalogUriHandler handler = new StaticCatalogUriHandler();
        Uri processedUri = handler.BuildUri(url.ToString(), url.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase));
        if (processedUri == null)
            return null;

        return new CommercePageContext
            PreviewUrl = processedUri.ToString(),
            RequestedUri = processedUri,
            Uri = processedUri,
            Data = null

    public int SortOrder { get; set; }

public class CommercePageContext : ClientContextBase
    public override string DataType { get; set; }

I don't think it even has to go through the StaticCatalogUriHandler.

Feb 04, 2016 12:50

Looks like a nice workaround. Nice catch!

Edited, Feb 04, 2016 14:02
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.