我如何拥有具有相同名称但在不同文件夹中的多个控制器
我有2个具有相同名称的控制器,但其中一个是在一个名为“ V2”的子文件夹中,当我运行应用程序时,我会收到此错误
Multiple types were found that match the controller named 'Article'
我试图在我的webapiconfig.cs中添加命名空间但这无济于事
// Api V2 Route
config.Routes.MapHttpRoute(
name: "DefaultApiV2",
routeTemplate: "api/v2/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
I have 2 controllers that have the same name but one of them is in a subfolder called "v2", when I run the application I get this error
Multiple types were found that match the controller named 'Article'
I tried to add the namespace in my WebApiConfig.cs but that does not help
// Api V2 Route
config.Routes.MapHttpRoute(
name: "DefaultApiV2",
routeTemplate: "api/v2/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论