404 Error on ASP.NET 4.5 on IIS 7

I recently tried deploying a new ASP.NET 4.5 MVC 3 application to our production web server. Everything worked fine on test and on my local machine, so I was not expecting trouble on production. But after I deployed it to production, every URL below the top-level immediately returned a 404 HTTP error. Other applications worked fine, but the new one gave me lots of trouble. This took a bit of work to figure out, but here’s the answer.…