【问题标题】:MVC Tutorial, Server name not found or cannot be accessedMVC 教程,服务器名称未找到或无法访问
【发布时间】:2014-12-10 21:42:02
【问题描述】:

我对 MVC 很陌生,所以我在本教程中尝试了自己,这似乎是个好主意:http://www.asp.net/mvc/overview/getting-started/introduction/getting-started

一切都非常顺利,直到我进入第 5 章创建模型。 我以与教程所说的“几乎”相同的方式创建了模型(下拉列表中没有相同的应用程序上下文,所以我采用了提供的那个)并且确实有效。但是当我现在尝试启动应用程序时,我收到以下错误:

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 应用程序

希望有人可以帮助我,因为我不知道我做错了什么。

【问题讨论】:

  • 您检查以确保您安装了 LocalDB 功能吗?
  • 你有没有使用数据库?
  • @svanelten 我该如何检查?
  • @RahulSingh 是的,这似乎是我在发现我必须重新安装我的 VS 后面临的问题,因为似乎还有一些其他问题无法找到 LocalDB。

标签: c# asp.net asp.net-mvc


【解决方案1】:

那可能是你没有断开连接,试试这个:-

打开服务器资源管理器 -> DBContext(在你的情况下可能是 MovieDBContext),右键单击它并选择 Close Connection

另外,您需要为实体框架数据库上下文设置正确的连接字符串名称。签入Web.Config 文件,您的 ConnectionStrings 键名应与您的 DBContext 完全匹配(此处为 MoviesDBContext)。

另外,我注意到您说,您无法在下拉列表中找到正确的 DBContext,这是因为您在此之前可能没有构建您的解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多