Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Problem found, and it is with the routing tables (cheers Kirill).</p> <p>Basically we have lots of routes that look something like this:</p> <pre><code>string[] controllers = GetListOfValidControllers(); routes.MapRoute( name: GetRouteName(), url: subfolder + "/{controller}/{action}/{id}", defaults: new { action = "Index", id = UrlParameter.Optional }, constraints: new { controller = "(" + string.Join("|", controllers) + ")" }); </code></pre> <p>It turns out that <a href="http://samsaffron.com/archive/2011/10/13/optimising-asp-net-mvc3-routing">the Regex check is very slow</a>, painfully slow. So I replaced it with an implementation of <code>IRouteConstraint</code> that just checks against a <code>HashSet</code> instead.</p> <p>Then I changed the map route call:</p> <pre><code>routes.MapRoute( name: GetRouteName(), url: subfolder + "/{controller}/{action}/{id}", defaults: new { action = "Index", id = UrlParameter.Optional }, constraints: new { controller = new HashSetConstraint(controllers) }); </code></pre> <p>I also used the <a href="http://samsaffron.com/archive/2011/10/13/optimising-asp-net-mvc3-routing">RegexConstraint mentioned in that linked article</a> for anything more complicated - including lots of calls like this (because we have legacy WebForm pages):</p> <pre><code>routes.IgnoreRoute( url: "{*allaspx}", constraints: new { allaspx = new RegexConstraint( @".*\.as[pmh]x(/.*)?") }); </code></pre> <p>Those two simple changes completely fix the problem; <code>Url.Action</code> and <code>Html.BeginForm</code> now take a negligible amount of time (even with lots of routes).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload