我对MVC很陌生,所以我在本教程中尝试了自己似乎是一个好主意:http://www.asp.net/mvc/overview/getting-started/introduction/getting-started
在我第5章创建模型之前,一切都很顺利。 我以“差不多”的方式创建了模型,就像教程所说的那样(Didnt在下拉列表中有相同的应用程序上下文,所以我拿了一个已经呈现的那个)并且确实有效。但是当我尝试启动应用程序时,我收到以下错误:
A network-related or instance- specific error occurred while establishing a connection to SQL Server . The server was not found or it can not be accessed. Verify that the instance name is correct and that SQL Server allows remote connections. (provider : SQL Network Interfaces , error : 56 - \ " SQLUserInstance.dll \ " can not be loaded from the location specified in the registry Verify that the function Local Database Runtime SQL Server Express is installed correctly. .
内部异常将是:%1不是有效的Win32应用程序
希望有人可以帮助我,因为我不知道我做错了什么。
答案 0 :(得分:0)
这可能是因为你没有断开连接,试试这个: -
打开服务器资源管理器 - > DBContext(在您的情况下可能是MovieDBContext),右键单击并选择Close Connection
。
此外,您需要为实体框架数据库上下文设置正确的连接字符串名称。签入Web.Config
文件,您的ConnectionStrings密钥名称应与您的DBContext(MoviesDBContext here)完全匹配。
另外,我注意到你说过,你在下拉列表中找不到合适的DBContext,因为在这之前你可能没有构建你的解决方案。