SQL SERVER的LocalDB问题在Asp.NET MVC 4项目 [英] Sql Server LocalDB Issue In Asp.NET MVC 4 Project

查看:379
本文介绍了SQL SERVER的LocalDB问题在Asp.NET MVC 4项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到每当我试图打开db_name.mdf文件以下错误:

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" />

我工作的Visual Studio中的一个asp.net的MVC 4项目。

I am working on a asp.net mvc 4 project within visual studio.

任何帮助来获得解决这个问题都非常AP preciated。谢谢你。

Any help to get the issue resolved are very much appreciated. Thanks.

推荐答案

的LocalDB是<一个href=\"http://blogs.msdn.com/b/sqlex$p$pss/archive/2011/07/12/introducing-localdb-a-better-sql-ex$p$pss.aspx\"相对=nofollow>在SQL 2012推出前preSS 新功能 - 你需要的安装SQL 2012前preSS的LocalDB 如果你需要以这种方式使用中密度纤维板。

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.

克日什托夫·Kozielczyk 对的LocalDB的此处 - 下完整的IIS运行时,采取特别的问题记

Krzysztof Kozielczyk has blogged several entries around on LocalDB here - take note especially of the issues when running under 'Full IIS'.

IMO使用的LocalDB与ASP.NET仅用于开发机的配置 - 即当你准备部署你的MVC 4应用测试或生产环境中,应考虑附加<$(第一code?) C $ C> ASPNETDB.MDF 更长久地为SQL实例。

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项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆