Hey All,
We're using EpiServer 9.8 and getting a strange error when loading our top-level category page. What's weird about it is if you refresh the page, it works just fine and the error cannot be reproduced again until you refresh the app pool in IIS. The error we're getting is:
"The routed data is of type 'CMS.Models.Commerce.Catalog.CategoryContentType' and the binding context data 'currentPage' is of type 'CMS.Models.Commerce.Catalog.CategoryContentType', neither of which matches the requested type 'CMS.Models.Pages.SitePageData'."
Stack trace:
[TypeMismatchException: The routed data is of type 'CMS.Models.Commerce.Catalog.CategoryContentType' and the binding context data 'currentPage' is of type 'CMS.Models.Commerce.Catalog.CategoryContentType', neither of which matches the requested type 'CMS.Models.Pages.SitePageData'.]
EPiServer.Web.Mvc.ContentDataModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +769
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +296
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +105
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +445
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +129
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +302
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +30
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +129
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +338
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +129
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +316
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +71
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +129
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +251
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +103
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
And here is our code for the controller's ActionResult:
namespace CMS.Controllers.Commerce { public class CategoryController : ContentController<CategoryContentType> { public ActionResult Index(CategoryContentType currentContent, SitePageData currentPage) { CommerceCoreRepository CommerceData = new CommerceCoreRepository(Global.DatabaseConnection.EOShared); CultureInfo currentCulture = ContentLanguage.PreferredCulture; string languageCode = currentCulture.Name; ViewBag.CurrentPage = currentPage; CategoryModel model = new CategoryModel() { Breadcrumb = new BreadcrumbModel(currentContent), Category = currentContent }; return View("/Views/Commerce/Product/Category/Index.cshtml", model); } } }
Any insight or experience with this would be greatly appreciated, we're a bit stumped.
Thanks!
John