0

我一直在嘗試通過代碼優先遷移來嘗試使用SQL Server數據庫。對於我的最新嘗試,我:在ASP.NET MVC 4中使用SQL Server數據庫進行代碼優先遷移

  • 創造了一個新的ASP.NET MVC 4 Web應用程序項目(是的,我想用這個模板)
  • 創建的模型實體
  • 創建繼承數據上下文類從的DbContext
  • 放置在Web.config下面的連接字符串駐留在應用程序的根:

    add name="DefaultConnection" connectionString="Data Source=.\sqlexpress;Integrated Security=true;Initial Catalog=DatingAnAsianWoman;MultipleActiveResultSets=true;providerName=System.Data.SqlClient" 
    
  • 在PAC卡格經理我輸入:

    Enable-Migrations -ContextTypeName UsersContext 
    
  • 其次:

    Update-Database 
    

在這一點上我收到以下錯誤:

The connection string 'DefaultConnection' in the application's configuration file does not contain the required providerName attribute." 

我希望得到任何幫助都。

回答

0

確認!我甚至沒有意識到providerName被指定爲一個單獨的鍵值!

相關問題