我很新設置SQL Server數據庫並連接到它(Visual Studio 2012 for Web)。我已經下載了SQL Server 2014,並且在我的服務中運行了SQL Server(Express)。如何使用EF應用程序爲我的ASP.NET MVC設置連接到SQL Server
我無能,我的下一步應該是什麼,我設置使用SQL Server Express在Database Explorer視圖中的數據連接,但是當我嘗試update-database
在我的包管理器控制檯,我得到
提供者未返回ProviderManifest實例
這可能是因爲我的連接字符串是錯誤的。
連接字符串:在全文
PM> update-database
無待基於代碼的遷移
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=RecreationalServices;Integrated Security=False" providerName="System.Data.SqlClient" />
錯誤代碼。
System.Data.ProviderIncompatibleException:提供程序未返回ProviderManifest實例。 ---> System.ArgumentException:無法確定存儲版本;需要有效的存儲連接或版本提示。
在System.Data.SqlClient.SqlVersionUtils.GetSqlVersion(字符串versionHint)
在System.Data.SqlClient.SqlProviderManifest..ctor(字符串manifestToken)
在System.Data.SqlClient.SqlProviderServices.GetDbProviderManifest(字符串versionHint)
在System.Data.Common.DbProviderServices.GetProviderManifest(字符串manifestToken)
---內部異常堆棧跟蹤的結尾---
在System.Data.Common.DbProviderServices.GetProviderManifest(字符串manifestToken)
在系統。 Data.Metadata.Edm.StoreItemCollection.Loader.InitializeProviderManifest(Action3 addError)
3 addError)
at System.Data.Metadata.Edm.StoreItemCollection.Loader.OnProviderManifestTokenNotification(String token, Action
在System.Data.EntityModel.SchemaObjectModel.Schema.HandleProviderManifestTokenAttribute(的XmlReader讀取器)
在System.Data.EntityModel.SchemaObjectModel.Schema.HandleAttribute(的XmlReader讀取器)
在System.Data.EntityModel.SchemaObjectModel.SchemaElement.ParseAttribute (的XmlReader讀取器)
在System.Data.EntityModel.SchemaObjectModel.SchemaElement.Parse(的XmlReader讀取器)
在System.Data.EntityModel.SchemaObjectModel.Schema.HandleTopLevelSchemaElement(的XmlReader讀取器)
在System.Data.EntityModel.SchemaObjectModel .Schema.InternalParse(XmlReader sourceReader,String sourceLocation)
at System.Data.EntityModel.SchemaObjectModel.Schema.Parse(XmlReader sourceReader,String sourceLocation)
at System.Data.EntityModel.SchemaObjectModel.SchemaManager。ParseAndValidate(IEnumerable的1 xmlReaders, IEnumerable
1 sourceFilePaths,SchemaDataModelOption數據模型,AttributeValueNotification providerNotification,AttributeValueNotification providerManifestTokenNotification,ProviderManifestNeeded providerManifestNeeded,IList的1& schemaCollection)
1個xmlReaders,IEnumerable的
at System.Data.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable1 sourceFilePaths)
1個xmlReaders,IEnumerable的 cachedCTypeFunction)
at System.Data.Metadata.Edm.StoreItemCollection.Init(IEnumerable
在System.Data.Metadata.Edm.StoreItemCollection..ctor (IEnumerable的1 xmlReaders)
1 pendingMigrations,字符串targetMigrationId,字符串lastMigrationId)
at System.Data.Entity.Migrations.Extensions.XDocumentExtensions.GetStoreItemCollection(XDocument model, DbProviderInfo& providerInfo)
at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, String connectionString)
at System.Data.Entity.Migrations.DbMigrator.IsModelOutOfDate(XDocument model, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable
在System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations,字符串targetMigrationId,字符串lastMigrationId)
在System.Data.E ntity.Migrations.DbMigrator.Update(字符串targetMigration)
在System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(字符串targetMigration)
在System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore( ) at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run() 提供程序沒有返回ProviderManifest實例。
如果'IntegratedSecurity'是假的,你必須提供'用戶Id'和'Password'屬性。 – Crowcoder
有很多這個教程。只是谷歌它的'mvc ef tutorial' –
@JuanCarlosOropeza當然,我知道如何谷歌。他們中的大多數人希望你首先使用本地數據庫,這是我不想做的。 – TykiMikk