http errors 404 page taking a long while to load - EpiServer 7

418 Views Asked by At

I have an EpiServer 7 site, that I am trying to wire up a custom 404 page to.

I solution works fine when running locally. When I deploy to the staging server (site not get live), it takes 2-3 minutes to display my 404 page. If I log onto the server, and run the same URL, I get the custom 404 page displaying right away?

My entry inside web.config is (inside ):

    <httpErrors errorMode="Custom" existingResponse="Replace">
  <clear />
  <error statusCode="404" responseMode="ExecuteURL" prefixLanguageFilePath="en" path="/system/pagenotfound/" />
</httpErrors>

Any ideas?

2

There are 2 best solutions below

0
On

I had the same kind of issue, do you have a custom route mapping? Like:

 protected override void RegisterRoutes(RouteCollection routes)
 {
        routes.MapRoute("404", "404", 
            new { controller = "ContentPage", action = "NotFound" });

        base.RegisterRoutes(routes);
 }

Remove that route and add the following catch all route:

protected override void RegisterRoutes(RouteCollection routes)
{
    base.RegisterRoutes(routes);

    routes.MapRoute("Error", "{*url}",
        new { controller = "ContentPage", action = "NotFound" });
}
0
On

I met same issue and realize it's because of globalErrorHandling on episerver.config. You should set it to "Off", which I guess on your episerver.config is now "RemoteOnly".

Hope this helps