我一个项目都基本上做完了,结果部署到我服务器的时候结果一直报404 找不到 一看global.asax有个路由注册的代码

public static void RegisterRoutes(RouteCollection routes)
{
    routes.EnableFriendlyUrls();
}


放在IIS中 始终是找不到类似伪静态的地址

如:localhost/default这种

找了两天 我还把多个IIS里面的模块都一一比对 还是不对,最后在老外的一篇文章中终于解决了这个问题

http://weblog.west-wind.com/posts/2011/Mar/27/ASPNET-Routing-not-working-on-IIS-70

在web.config 添加

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"> 
</modules>
</system.webServer>

如果不加上面的话IIS会用自己的解析方式去解析 所以一直解析不到

原文出处:http://www.cnblogs.com/hack1506/p/3982405.html

http://aspnetfriendlyurls.codeplex.com/

 

相关文章:

  • 2021-08-17
  • 2021-09-17
  • 2021-09-14
  • 2021-11-14
  • 2021-09-13
  • 2021-09-30
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2021-07-08
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案