0

I can't seem to get MVC to ignore this route (throws an Controller not found if file doesn't exist - which happens occasionally and is expected if the generation isn't complete)

 /WebDirectory/signalFiles/52f23308-6d2d-40e6-9048-319e0539c83d.txt

I'm trying this right now in the Global.ASAX to eliminate the error

 routes.IgnoreRoute("{*signalstxt}", new { signalstxt = @".*/signalFiles/.*.txt" });

this matches perfectly in the RegEx tester but does nothing in the actual app

Any thoughts?

James Troutman
  • 211
  • 1
  • 2
  • 5

1 Answers1

0

Because of the way IIS 7 & MVC3 handle requests through the managed pipeline, it takes a good deal of effort to prevent running static file requests through the routing engine. I've seen some evidence that moving the static files to a virtual directory outside of the web applications directory would have the desired effect, but haven't had a chance to test this for myself.

edit

clarification: the exception you are seeing is a normal part of MVC3 operation. It is how the handlers notify the IIS pipeline that it was unable to handle a request, thus invoking the next handler. You can prevent it from interfering with your debugging by enabling "just my code" in the Visual Studio Debug settings.

Community
  • 1
  • 1
RyanR
  • 7,728
  • 1
  • 25
  • 39