Cannot add controller in ASP.NET MVC project

与世无争的帅哥 提交于 2019-12-06 14:19:22

Seems that the special constructor I added to the DbContext caused the problem. After commenting out the constructor and re-compiling, it's working back again.

Perhaps I should wrap the constructor contents in a conditional statement that is skipped at design-time, meanwhile commenting-out is enough for me.

"Build the application before going on to the next step. If you don't build the application, you'll get an error adding a controller." "If you get an error, you probably didn't build the application before starting adding the controller." You must run project, probability. http://www.asp.net/mvc/overview/getting-started/introduction/accessing-your-models-data-from-a-controller

Venusha

Just have an empty DbContext subclass when adding the controller. Then it will work fine for you...

If you are on Windows OS press CTRL + SHIFT + B to build the application then try again to add Controller

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