IIS Express does not respect dynamic routes

posted in

If you are using IISExpress for your web server during development, and you try to route static files to dynamic files, IISExpress will not respect rerouting those files.

Ie, if you have a dynamic robots.txt file like this:

            routes.MapRoute("Robots.txt",
                "robots.txt",
                new { controller = "Home", action = "Robots" });

You will get a standard 404 error which tries to map it to a static handler.

To fix, you need to configure web.config like so:
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
    </modules>
  </system.webServer>
Find a problem or mistake? File a bug or better yet, submit a pull request
Copyright © 2010 - 2022 - Doug Tarr