I've recently deployed a SC 8.1 update 3 site to production (seperate CM and CD) and on the CD side I'm getting this error:

Server Error in '/' Application.

No route in the route table matches the supplied values. 
  Description: An unhandled exception occurred. 

 Exception Details: System.InvalidOperationException: No route in the route table matches the supplied values.

Source Error: 

Line 14:     <meta charset="utf-8" />
Line 15:     <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
Line 16:     @Html.Action("Metadata", "Metadata")
Line 17:     <meta name="viewport" content="width=device-width" />
Line 18:     <!-- END: Meta Data -->


 Source File:  D:\Apps\Sitecore\Website\Views\Website\Layouts\Default.cshtml    Line:  16 

Stack Trace: 

[InvalidOperationException: No route in the route table matches the supplied values.]
   System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +651
   System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +114
   ASP._Page_Views_Website_Layouts_Default_cshtml.Execute() in D:\Apps\Sitecore\Website\Views\Website\Layouts\Default.cshtml:16
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +137
   Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +343

Why isn't the Sitecore MVC routing picking this up? (I'm not using any custom routings btw.)

I haven't come across this in any other environments (dev/test/qa) and I'm currently pulling my hairs out why this is happening. I've spent the last day looking into differences between the environments but I think I'm staring myself blind on this one.

up vote 7 down vote accepted

Methods like @Html.Action(), @Html.RenderAction etc. apparently requires a route with the {controller}/{action} pattern (even though it isn't actually relevant from what I can see).

The config file Sitecore.Speak.Mvc.config contains such a route. Although the route is Sitecore specific it does contain the {controller}/{route} pattern.

However, the Sitecore.Speak.Mvc.config should be disabled on CD, Processing and Reporting servers (according to Sitecore's Config Enable-Disable documents).

To solve the problem you should be able to just add a bogus route to the route table manually (like in a standard ASP.NET MVC solution) containing the {controller}/{action} pattern. Just make sure it is something that would otherwise never get matched by a real URL on your site.

Something like this (in the initialize pipeline):

RouteTable.Routes.MapRoute(
    "Bogus-Required-Route",
    "bogus-required-route/{controller}/{action}",
);
  • Ah yes that's it! Thank a million Søren! – Marc Dec 15 '16 at 14:06
  • 1
    To clarify a bit more: as per the enable/disable docs I had the Sitecore.Speak.Mvc.config disabled on CD. I've enabled it for now until I have added your suggested bogus route ;). – Marc Dec 15 '16 at 14:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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