Reputation: 113
In my MVC2 .NET 4.0 app on Windows Server 2008 I can set a breakpoint inside my controller factory and all static content, specifically image requests hit the breakpoint. Furthermore, an exception is thrown because there is no controller that matches the route defined by the image's URL.
This is different from the last app I worked on, an ASP.NET 3.5 app on Windows Server 2003. In that app, IIS served all the images without any .NET application code being touched.
How can I configure my MVC app so that IIS serves the images directly?
Upvotes: 0
Views: 187
Reputation: 1038770
Try ignoring them:
routes.IgnoreRoute("{resource}.jpg");
routes.IgnoreRoute("{resource}.png");
routes.IgnoreRoute("{resource}.gif");
...
Upvotes: 2