【发布时间】:2016-03-01 19:02:02
【问题描述】:
我正在使用 Visual Studio 2012 for Web 并且正在编写 MVC 应用程序。默认情况下,它使用 localDB,但我希望它在 SQL Server 上。我已经安装了 SQL Server 2014,我的服务器名称是 C0208\SQLEXPRESS。
C0208 是我的电脑名
命名实例:SQLEXPRESS
InstanceID:SQLEXPRESS
这是我到 localdb 的连接字符串
<add name="IssueContext" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=RecreationalServicesTicketingSystem;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\RecreationalServicesTicketingSystem.mdf" providerName="System.Data.SqlClient" />
我试过用这个连接字符串,不知道对不对
<add name="IssueContext" providerName="System.Data.SqlClient" connectionString="Data Source=C0208\SQLEXPRESS;User Id=C0208;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />
【问题讨论】:
-
我可以进入索引页面,但它不允许我使用其他选项卡 所以?我收到此错误
Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration. -
@David 我有 2 个反复出现的错误。我上面提到的一个和另一个关于无法找到与数据库的连接的问题。
标签: sql-server asp.net-mvc-4 database-connection connection-string