2015-12-20 94 views
0

我是ASP.NET MVC編程中的新成員,我按照教程"Entity Framework 6" from Pluralsight從Model自動創建具有「update-database ..」的表不起作用

我目前被困在「多遷移」部分。他說,命令

update-database -ConfigurationTypeName Books.Web.DataContexts.IdentityMigrations.Configuration 

在package-manager-console中會自動在服務器資源管理器中創建表。但它不起作用。我得到這樣一個錯誤:

Network related or instance -specific error occurred while establishing a connection to SQL Server . The server was not found , or can not access it . Check if the instance name is correct and that SQL Server allows remote connections. Error: 50 - Error in the Local Database Runtime. The specified LocalDB instance does not exist.

我已閱讀與類似問題的其他問題,但我無法修復它。

+0

你可以從你的web.config文件發佈你的連接字符串嗎? – kevindeleon

+0

sure, maxmusterman

+0

難以...好吧,我相信他會經歷設置環境,以及如果他正在教授實體,那該怎麼辦? ..我會回去通過並仔細檢查你的DataContexts是否都設置得當,並且DefaultConnection是基於你可用的服務器,dbs等是正確的...... – kevindeleon

回答

0

這聽起來像是A)您沒有運行數據庫服務器,或者您沒有連接到服務器或B)您的web.config中的連接字符串是錯誤的。

+0

答)根據教程,我不必建立一個數據庫服務器。 Visual Studio確實有自動完成的服務器數據工具。 B)我沒有改變什麼,導師也沒有改變任何東西 – maxmusterman