System.Web.Routing only working with a .aspx file

2019-09-09 07:18发布

问题:

I have an application, that uses System.Web.Routing and it works great on all my environments. The only issue is, that my staging environment needs the ".aspx" at the end or I will get a 404. All other environments do not require it. They all run in Classic for the Managed Pipeline Mode with v4.0 .NET framework. I keep comparing IIS settings, but I can't find any differences. I've even compared web.config and machine.config, but no differences there either. Anybody know what it could be?

回答1:

Make sure you have this in your web.config (and normally you do want Integrated, unless you can't for some reason and jump through the hoops so it works under Classic).

  <system.webServer>
    <!-- omitted for brevity -->
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

runaAllManagedModulesForAllRequests has gotten me a couple times in the past.