ASP.Net MVC2 Routing可选参数给出404

时间:2011-02-22 22:36:05

标签: asp.net-mvc-2 iis-6 asp.net-mvc-routing

我们有MVC2映射......

routes.MapRoute(
  "HomeKeepAlive",
  "{controller}/KeepAlive/{objectType}/{id}",
  new { controller = "Home", action="KeepAlive", objectType = UrlParameter.Optional, id = UrlParameter.Optional }
);

routes.MapRoute(
  "DefaultRoute",
  "{controller}/{action}/{id}",
  new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

所有服务器都是Windows Server 2003 sp2,安装了.Net 4的IIS6。

路线适用于我们的测试服务器

/Home/Ping

/Home/Ping/1

/Home/KeepAlive/Article

/Home/KeepAlive/Article/5

但是在我们的直播服务器上只有没有身份证工作的网址,例如

/Home/Ping
/Home/KeepAlive/Article

而那些有id的人会给出404

/Home/Ping/1
/Home/KeepAlive/Article/5

鉴于测试服务器工作,我假设问题是我们的实时服务器上的IIS6的配置问题,但我看不出它们之间有任何差异。

以前有人见过这样的事吗?

2 个答案:

答案 0 :(得分:0)

查看this post,了解最近推出的可能导致问题的ASP.net中的错误。

答案 1 :(得分:0)

相关问题