+ -
当前位置:首页 → 问答吧 → 求高手指点

求高手指点

时间:2011-12-22

来源:互联网

.NET MVC3写的,运行的时候出这个错误
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[MessageBD.Models.LogInfo]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[MessageBD.Models.MessageBoard]'.


估计是路由问题
public static void RegisterRoutes(RouteCollection routes)
  {
  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

  routes.MapRoute(
  "Default", // Route name
  "{controller}/{action}/{id}", // URL with parameters
  new { controller = "Home", action = "MessageBoardIndex", id = UrlParameter.Optional } // Parameter defaults
  );

  }

我在URL里输入“http://localhost:111/messageboard”
结果出现上述错误


求高人指点,如何改

作者: jl2xs   发布时间: 2011-12-22

很显然,页面接收的Model类型,与控制器返回的类型不匹配

作者: Return_false   发布时间: 2011-12-22

俺是新人,嘿嘿

作者: jl2xs   发布时间: 2011-12-22

相关阅读 更多