Controller ambigous error, upgraded to MVC 2

∥☆過路亽.° 提交于 2019-12-04 17:46:23

Your first route suggests that there is a class /controllers/Admin/AdminController.cs. Is this correct?

Also, have a read of this. It looks like you've provided the namespace area, but they don't reside the same structure that seems to be required for ASP.NET MVC v2.

Your project solution structure should look like this:

  • Areas
    • Admin
      • ProductController
  • Controllers
    • ProductController

Your structure appears to look like this.

  • Controllers
    • Admin
      • ProductController
    • ProductController

There was a change made to MVC 2 Beta where specifying a namespace (like "MyNamespace.Web.Controllers") would search in that namespace and its child namespaces. This differs from the MVC 1 behavior, where specifying a namespace would cause the factory to look in just that namespace.

This change will be reverted before MVC 2 RTM. Specifically, the MVC 2 RTM behavior will be that specifying "MyNamespace.Web.Controllers" will search just that namespace - just as in MVC 1 - and specifying "MyNamespace.Web.Controllers.*" (note the dot-star) will search that namespace plus its children.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!