问题描述
在VS 2015中,对于我的Web.API项目,我通过npm从nuget安装了MVC 5.此安装在Views文件夹下添加了引用并生成了web.config文件.
In VS 2015, for my Web.API project, I installed MVC 5 from nuget via npm.This installation added references and generated web.config file under Views folder.
我添加了带有生成的CRUD函数的新Controller.当我右键单击并转到查看操作"时,就没有问题了.但是反向动作不起作用.如果我导航通过浏览器查看,它也可以正常工作. Web应用程序也会编译.
I added new Controller with generated CRUD functions. When I right click and go to View on action it goes with no problem. But reverse action does not work. If I navigate to view via browser it works as well. Web app compiles as well.
我有什么办法可以解决VS中的导航问题?我忘了添加一些东西吗?
Is there any way for me to fix this navigation problem in VS? Did I forget to add something?
后续作品
以下给出错误:
P.S:如果我创建了全新的示例MVC 5应用程序,那么这两个操作都可以按预期工作,那么这只会发生在Web.API项目中,后来通过nuget添加了MVC 5.
P.S: If I create brand new sample MVC 5 app both actions work as expected, this only happens Web.API project where MVC 5 added later on via nuget.
推荐答案
当控制器或视图可能分别不完全位于控制器文件夹或视图文件夹中时,会发生这种情况.它可能包含一个额外的文件夹.您可以通过添加新视图并删除旧视图来解决此问题.
It happens while the controller or view may be not exactly in the controller folder or view folder respectively. It may contain an additional folder. You can solve this issue through adding a new view and delete the old view.
这篇关于转到控制器显示“无法找到匹配的控制器".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!