I've implemented a few css files in an EPiServer 7 MVC application.
<link href="/Static/Web/CSS/main.css" rel="stylesheet" />
<link href="/Static/Web/CSS/print.css" rel="stylesheet" />
The routing may be a bit trigger happy since when I look at the logs this shows up in the log after every page load.
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/print.css' since it doesn't start with '~/EPiServer/Shell/2.0.86'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/print.css' since it doesn't start with '~/EPiServer/EPiServer.Packaging.UI/2.0.86'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/print.css' since it doesn't start with '~/EPiServer/CMS/2.0.79'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/print.css' since it doesn't start with '~/episerver'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/print.css' since it doesn't start with '~/modules'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/main.css' since it doesn't start with '~/EPiServer/Shell/2.0.86'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/main.css' since it doesn't start with '~/EPiServer/EPiServer.Packaging.UI/2.0.86'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/main.css' since it doesn't start with '~/EPiServer/CMS/2.0.79'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/main.css' since it doesn't start with '~/episerver'
DEBUG EPiServer.Shell.Web.Routing.ModuleRouteCollection: Not routing '~/Static/CSS/main.css' since it doesn't start with '~/modules'
Why does it try to route the included files and how do I disable it?
Thanks
EPiServer adds a few routes to the
RouteTable
that are used for CMS/Admin/Modules etc.When you request /Static/Web/CSS/main.css the routing will go through the route table in order and try to find the first route that matches. The
ModuleRouteCollection
route will only match if the URL starts with ~/episerver or ~/modules etc. If it doesn't it will log a debug-message, but only if you have configured log4net to log debug messages.If you want to avoid these messages you could have a look at this StackOverflow post "log4net: Configure to ignore messages from a specific class" and ignore the "EPiServer.Shell.Web.Routing.ModuleRouteCollection" namespace.
Typical route table for an EPiServer 7 site: