Skip to content

Instantly share code, notes, and snippets.

@jpolvora
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpolvora/6e1306dcd384be56ee59 to your computer and use it in GitHub Desktop.
Save jpolvora/6e1306dcd384be56ee59 to your computer and use it in GitHub Desktop.
Instrui o ASP.NET MVC a ignorar arquivos estáticos e ignorar algumas pastas, evitando erros 404 desnecessários.
/*Global.asax.cs ou RouteConfig.cs*/
var routes = RouteTable.Routes;
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*staticfile}", new { staticfile = @".*\.(?i)(asp|aspx|css|js|xml|txt|png|gif|jpg|jpeg|bmp|ico|woff|svg|ttf|eot)(/.*)?" });
routes.IgnoreRoute("Content/{*pathInfo}");
routes.IgnoreRoute("Scripts/{*pathInfo}");
routes.IgnoreRoute("Bundles/{*pathInfo}");
@jpolvora
Copy link
Author

System.Web.HttpException (0x80004005): The controller for path '/favicon.ico' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment