问题描述
当我尝试打开db_name.mdf文件时,我收到以下错误:
数据库'{path } \db_name.MDF'无法打开,因为它是版本706.此服务器支持版本662及更早版本。不支持降级路径。无法打开新数据库'db_name.MDF'。 CREATE DATABASE中止了。尝试附加文件{$ path} \db_name.mdf的自动命名数据库失败。存在具有相同名称的数据库,或指定的文件无法打开,或位于UNC共享上。
连接字符串如下:
< add name =PasswordDBContextconnectionString =Data Source =(LocalDB)\v11.0; AttachDbFilename = | DataDirectory | \db_name.mdf; Integrated Security = TrueproviderName = System.Data.SqlClient/>
我正在Visual Studio中工作的一个asp.net mvc 4项目。
非常感谢任何解决问题的帮助。谢谢。
LocalDB是一个 - 您将需要,如果您需要在此使用MDF
已经发表了几个条目在LocalDB上 - 特别注意在完整IIS下运行时的问题。 / p>
使用ASP.NET的LocalDb的IMO仅适用于开发者机器配置 - 即当您准备好将(代码优先)的MVC 4应用程序部署到测试或生产环境,你应该考虑附件g ASPNETDB.MDF
更永久地添加到SQL实例。
I am getting the following error whenever I am trying to open the db_name.mdf file:
The database '{path}\db_name.MDF' cannot be opened because it is version 706. This server supports version 662 and earlier. A downgrade path is not supported. Could not open new database 'db_name.MDF'. CREATE DATABASE is aborted. An attempt to attach an auto-named database for file {$path}\db_name.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Connection string as follows:
<add name="PasswordDBContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\db_name.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
I am working on a asp.net mvc 4 project within visual studio.
Any help to get the issue resolved are very much appreciated. Thanks.
LocalDB is a new feature introduced in SQL 2012 Express - you will need to install SQL 2012 Express LocalDb if you need to use an MDF in this manner.
Krzysztof Kozielczyk has blogged several entries around on LocalDB here - take note especially of the issues when running under 'Full IIS'.
IMO using LocalDb with ASP.NET is for a developer machine config only - i.e. when you are ready to deploy your (code first?) MVC 4 app to a testing or production environment, you should consider attaching ASPNETDB.MDF
more permanently to a SQL Instance.
这篇关于Sql Server LocalDB问题在Asp.NET MVC 4项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!