Microsoft.AspNet.FriendlyUrls发布到IIS后404报错的解决方案

我一个项目都基本上做完了,结果部署到我服务器的时候结果一直报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/

 

posted on 2015-10-09 17:47  VincentZhu  阅读(591)  评论(0编辑  收藏  举报