![](/img/trans.png)
[英]SQL does not connect when published on local IIS on Razor pages project using entity framework
[英]Entity Framework Error message MYSQL, works on the local machine not when published
我在使用实体框架时遇到麻烦。 我创建了一个数据模型,并且在本地调试机器上一切正常,但是当我发布时,收到以下消息
System.Data.ProviderIncompatibleException:存储提供程序工厂类型'MySql.Data.MySqlClient.MySqlClientFactory'未实现IServiceProvider接口。 使用实现此接口的商店提供程序。 在System.Data.Metadata.Edm.StoreItemCollection.Loader.InitializeProviderManifest(操作3 addError) at System.Data.Metadata.Edm.StoreItemCollection.Loader.OnProviderManifestTokenNotification(String token, Action
处的System.Data.Common.DbProviderServices.GetProviderServices(DbProviderFactory工厂) 3 addError) at System.Data.Metadata.Edm.StoreItemCollection.Loader.OnProviderManifestTokenNotification(String token, Action
3在System.Data.EntityModel.SchemaObjectModel.Schema.HandleProviderManifestTokenAttribute(XmlReader阅读器)在System.Data.EntityModel.SchemaObjectModel.Schema.HandleAttribute(XmlReader阅读器)在System.Data.EntityModel.SchemaObjectModel.SchemaElement.ParseAttribute( System.Data.EntityModel.SchemaObjectModel.SchemaElement.Parse(XmlReader阅读器)的System.Data.EntityModel.SchemaObjectModel.Schema.HandleTopLevelSchemaElement(XmlReader阅读器)的System.Data.EntityModel.SchemaObjectModel.Schema.InternalParse(XmlReader sourceReader) ,位于System.Data.EntityModel.SchemaObjectModel.Schema.Parse(XmlReader sourceReader,字符串sourceLocation)处 System.Data.EntityModel.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable 1 xmlReaders, IEnumerable
1 sourceFilePaths,SchemaDataModelOption dataModel,AttributeValueNotification providerNotification,AttributeValueNotification providerManifestTokenNotification,ProviderManifestNeeded providerManifestNeeded,IList 1& schemaCollection) at System.Data.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable
1 xmlReaders,IEnumerable 1 sourceFilePaths) at System.Data.Metadata.Edm.StoreItemCollection.Init(IEnumerable
1 xmlReaders,IEnumerable 1 filePaths, Boolean throwOnError, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, Memoizer
2&System.Data。 System.Data.Metadata.Edm.MetadataCache.StoreMetadataEntry.LoadStoreCollection(EdmItemCollection edmItemCollection,MetadataArtifactLoader加载器)上的Edm.StoreItemCollection..ctor(IEnumerable 1 xmlReaders, IEnumerable
1 filePaths)在System.Data.MetadataCache.Edm.Meta上 System.Data.Metadata.Edm.MetadataCache.LoadItemCollection [T](IItemCollectionLoader 1 itemCollectionLoader, T entry) at System.Data.Metadata.Edm.MetadataCache.GetOrCreateStoreAndMappingItemCollections(String cacheKey, MetadataArtifactLoader loader, EdmItemCollection edmItemCollection, Object& entryToken) at System.Data.EntityClient.EntityConnection.LoadStoreItemCollections(MetadataWorkspace workspace, DbConnection storeConnection, DbProviderFactory factory, DbConnectionOptions connectionOptions, EdmItemCollection edmItemCollection, MetadataArtifactLoader artifactLoader) at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections) at System.Data.EntityClient.EntityConnection.InitializeMetadata(DbConnection newConnection, DbConnection originalConnection, Boolean closeOriginalConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery
(StoreMetadataEntry 1 itemCollectionLoader, T entry) at System.Data.Metadata.Edm.MetadataCache.GetOrCreateStoreAndMappingItemCollections(String cacheKey, MetadataArtifactLoader loader, EdmItemCollection edmItemCollection, Object& entryToken) at System.Data.EntityClient.EntityConnection.LoadStoreItemCollections(MetadataWorkspace workspace, DbConnection storeConnection, DbProviderFactory factory, DbConnectionOptions connectionOptions, EdmItemCollection edmItemCollection, MetadataArtifactLoader artifactLoader) at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections) at System.Data.EntityClient.EntityConnection.InitializeMetadata(DbConnection newConnection, DbConnection originalConnection, Boolean closeOriginalConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery
1 forMergeOption) at System.Data.Objects.ObjectQuery
1.System.Data.Objects.ObjectQuery 1.System.Collections.Generic.IEnumerable.GetEnumerator()处的1 itemCollectionLoader, T entry) at System.Data.Metadata.Edm.MetadataCache.GetOrCreateStoreAndMappingItemCollections(String cacheKey, MetadataArtifactLoader loader, EdmItemCollection edmItemCollection, Object& entryToken) at System.Data.EntityClient.EntityConnection.LoadStoreItemCollections(MetadataWorkspace workspace, DbConnection storeConnection, DbProviderFactory factory, DbConnectionOptions connectionOptions, EdmItemCollection edmItemCollection, MetadataArtifactLoader artifactLoader) at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections) at System.Data.EntityClient.EntityConnection.InitializeMetadata(DbConnection newConnection, DbConnection originalConnection, Boolean closeOriginalConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery
_Default.Page_Load(对象发件人, EventArgs e)
好像是库版本的东西。 您在开发和生产环境上运行的每个服务器和库的版本是什么?
看起来您的MySQL数据提供程序与EF不兼容。 您正在使用此连接器吗?
我希望这会对某人有所帮助。 我还有另一个需要添加MySql.Data.Entity.dll
DLL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.