开发者

Multiple types were found that match the controller named 'Home'

I've just started using dotnetopenauth for my user registration. It's great, and is working perfectly.

The problem is now I'm getting an error when I try to go to /Home/ which says:

Multiple types were found that match the controller named 'Home'. This can happen if the route that services this request ('{controller}/{action}/{id}') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' par开发者_如何学Goameter.

The request for 'Home' has found the following matching controllers: OpenIdRelyingPartyMvc.Controllers.HomeController

YourApp.Controllers.HomeController

The problem is, I have no idea where OpenIdRelyingPartyMvc.Controllers.Homecontroller is coming from. I can't find ANY instance of "OpenIdRelyingPartyMvc" anywhere in my app, save 2 places, both of which occur in the UsersController:

OpenIdRelyingParty openid = new OpenIdRelyingParty();

I've tried deleting the DLL and rebuilding the app - no change. I can't figure out where this other controller would be.

Any ideas?


I had the same error message after changing the name and default namespace of the project.

Finally the solution was to manually delete all the files from debug -folder ("Clean Solution"-function of VS didn't help in this case).


My guess is that you copied the code from the samples into your codebase or you are referencing the DLL from the DotNetOpenAuth sample project. Note, OpenIdRelyingPartyMvc is the namespace of the MVC example.

So my suggestion is to first remove all instances of the DotNetOpenAuth library by starting from the project references.


use this in route.config file

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional },
    new[] { "ProjectName.Controllers" }
);

Note: Project Name which you had given while creating the project

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜