2

In a DXA 1.7 .NET web application I have several custom DXA modules. After I moved a few models, views and controllers from one module to the other I got this routes error for one of the entities.

This shows up in the browser

A problem occurred while rendering this section
No route in the route table matches the supplied values.

The log recorded this error

    2017-08-17 08:54:33,329 [6] ERROR - No route in the route table matches the supplied values.
    System.InvalidOperationException: No route in the route table matches the supplied values.
       at System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter)
       at System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues)
       at Sdl.Web.Mvc.Html.HtmlHelperExtensions.DxaEntity(HtmlHelper htmlHelper, EntityModel entity, Int32 containerSize)
       at Sdl.Web.Mvc.Html.HtmlHelperExtensions.DxaEntities(HtmlHelper htmlHelper, Int32 containerSize)
       at ASP.........._MainSide_cshtml.Execute() in .........MainSide.cshtml:line 3
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at RazorGenerator.Mvc.PrecompiledMvcView.Render(ViewContext viewContext, TextWriter writer)
       at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
       at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
       at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)

What could cause this error?

3
  • Are you able to compile the webapplication after moving the items?
    – Rajesh
    Commented Aug 17, 2017 at 7:16
  • Yes, I can compile the web application, if it would not compile I could not run it to get this error ;)
    – Jan H
    Commented Aug 17, 2017 at 8:13
  • Have you updated the metadata fields of the Component Templates that use those views/controllers so they point to the correct module, and are they republished correctly? Commented Aug 17, 2017 at 9:02

2 Answers 2

2

In the RegisterArea() method of my module registration class (the one which extends BaseAreaRegistration), I did not call base.RegisterArea().

At the same time for an experiment the RegisterAllViewModels() of the module was called in a different way. Hence the registration of views and viewmodels worked fine, but the module's controllers did not work.

It appears that BaseAreaRegistration.RegisterArea() does register a default entity route. I do not know what exactly it does, but without it your custom controllers don't work.

0

For a .NET MVC Web application, Routes are registered in applictation_start method. Can you check whether you have these lines available in your web application's global.asax.cs file -> application_start method,

    RegisterRoutes(RouteTable.Routes);
    AreaRegistration.RegisterAllAreas();

verify that you have not modified the RegisterRoutes(RouteCollection routes) in the DXA web application which might also causes issues

1
  • Thanks for the hint but this was not the issue in my case.
    – Jan H
    Commented Aug 17, 2017 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.