2017-02-26 33 views
1

我在为我的EF6项目生成视图时出现以下错误,我查看了与相似错误相关的其他stackoverflow帖子,并相应地更新了我的app.config,我添加了MySql.Data.Entity.EF6作为提供程序,并且还为我的EF项目,我完全失去了我的问题是什么?任何人都可以提供有关该问题或如何调试的信息?未找到具有不变名称“MySql.Data.MySqlClient”的ADO.NET提供程序的实体框架提供程序。同时生成视图

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors: 
BitDatabaseModel.edmx(7,8) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. 
    at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.ThrowOnNonWarningErrors() 
    at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths) 
    at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, Boolean throwOnError, IDbDependencyResolver resolver) 
    at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError, IDbDependencyResolver resolver, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerInvariantName, String& providerManifestToken, Memoizer`2& cachedCTypeFunction) 
    at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection..ctor(IEnumerable`1 xmlReaders) 

的App.config

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </configSections> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
    </startup> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
     <parameters> 
     <parameter value="mssqllocaldb" /> 
     </parameters> 
    </defaultConnectionFactory> 
    <providers> 
    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider></providers> 
    </entityFramework> 
    <connectionStrings> 
    <add name="BitDatabaseEntities" connectionString="metadata=res://*/BitDatabaseModel.csdl|res://*/BitDatabaseModel.ssdl|res://*/BitDatabaseModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=xx.xx.xxx.xxx;user id=username;password=passwordname;persistsecurityinfo=True;database=aci_dev&quot;" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
<system.data> 
    <DbProviderFactories> 
     <remove name="MySQL Data Provider" 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" /></DbProviderFactories> 
</system.data></configuration> 

项目参考;

enter image description here

+0

一个数据点后解决的问题是在用'MySQL连接网6.9.9' – user3508811

+0

真的有那么这里回答这个没有其他问题?我看到这个问题经常出现。 –

+0

获取阿诺德 - 正如我所提到的,我看了其他帖子,并涵盖了他们的帖子中提到的一切,所以不知道我错过了什么?你有什么指针? – user3508811

回答

1

这是添加以下到Web.config中

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6"> 
相关问题