报错信息:
异常: Unable to determine the provider name for provider factory of type 'MySql.Data.MySqlClient.MySqlClientFactory'. Make sure that the ADO.NET provider is installed or registered in the application config. 6. 来源: EntityFramework 7. 实例: 在 System.Data.Entity.Utilities.DbProviderFactoryExtensions.GetProviderInvariantName(DbProviderFactory factory) 在 System.Data.Entity.Infrastructure.DependencyResolution.DefaultInvariantNameResolver.GetService(Type type, Object key) 在 System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) 在 System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() 在 System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) 在 System.Data.Entity.Infrastructure.DependencyResolution.RootDependencyResolver.GetService(Type type, Object key) 在 System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() 在 System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) 在 System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key) 在 System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key) 在 System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInvariantName(DbConnection connection) 在 System.Data.Entity.Internal.InternalConnection.get_ProviderName() 在 System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context) 在 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() 在 System.Data.Entity.Internal.InternalContext.Initialize() 在 System.Data.Entity.Internal.LazyInternalContext.get_ObjectContext() 在 System.Data.Entity.Internal.InternalContext.GetStateEntry(Object entity) 在 System.Data.Entity.Internal.InternalEntityEntry..ctor(InternalContext internalContext, Object entity) 在 System.Data.Entity.DbContext.Entry[TEntity](TEntity entity) 在 Qianchen.DataBase.MySqlEx.Database.Insert[T](T entity) 在 Qianchen.Application.Base.SystemModule.LogService.WriteLog(LogEntity logEntity)
Web.config文件加入配置解决:
<remove invariant="MySql.Data.MySqlClient" /> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />