MySQL和asp.net身份 [英] mysql and asp.net identity

查看:216
本文介绍了MySQL和asp.net身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能够得到asp.net mvc5身份使用MySQL。这里是web.config中的部分.Could这是怎么一回事,因为EF6的不mvc5工作?

 <&System.Data这GT;
    < D​​bProviderFactories>
      <清除NAME =MySQL的数据提供程序/>      <添加名称=MySQL的数据提供程序
          不变=MySql.Data.MySqlClient
          说明=用于MySQL的.NET Framework数据提供程序
          键入=MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data,文化=中性公钥= c5687fc88969c44d/>
    < / DbProviderFactories>
  < /system.data>的EntityFramework>
    < defaultConnectionFactory TYPE =MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data/>
      <供应商>
        <供应商invariantName =MySql.Data.MySqlClient
                  键入=MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.Entity/>
      < /供应商>
  < /&的EntityFramework GT;

该错误是:


  

其他信息:实体框架的实例成员
  提供商类型'MySql.Data.MySqlClient.MySqlProviderServices,
  MySql.Data.Entity,版本= 6.7.4.0,文化=中立,
  公钥= c5687fc88969c44d'没有返回一个对象,
  从System.Data.Entity.Core.Common.DbProviderServices'继承。
  实体框架供应商必须从这个类和继承
  实例成员必须返回供应商的单一实例。
  这可能是因为供应商不支持实体框架6
  或更高



解决方案

这是因为你引用EF 6,和MySQL连接器仍然不支持EF6。您可以降级到EF 5或获取的MySQL Connector阿尔法。

做到这一点(保持你刚才贴复印件):


  1. 删除所有引用EF6

  2. 从的NuGet获取EF 5(打开的NuGet控制台,然后输入安装封装的EntityFramework -Version 5.0.0)

  3. 重新生成实体

  4. 确保你得到的< D​​bProviderFactories> <供应商方式> 部分,就像你有

I am not able to get asp.net mvc5 identity to work with mysql. Here is the web.config part .Could it be beacuse of EF6 not working with mvc5 ?

<system.data>
    <DbProviderFactories>
      <remove name="MySQL Data Provider"/>

      <add name="MySQL Data Provider"
          invariant="MySql.Data.MySqlClient"
          description=".Net Framework Data Provider for MySQL"
          type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>

entityFramework>
    <defaultConnectionFactory type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
      <providers>
        <provider invariantName="MySql.Data.MySqlClient"
                  type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity" />
      </providers>


  </entityFramework>

The error is :

Additional information: The 'Instance' member of the Entity Framework provider type 'MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later

解决方案

That because you are referencing EF 6, and MySQL Connector still does not support EF6. You can either downgrade to EF 5 or get the MySQL Connector Alpha.

Do this (KEEP A COPY OF WHAT YOU JUST PASTED):

  1. Erase all references to EF6
  2. Get EF 5 from Nuget (open a NuGet console and type Install-Package EntityFramework -Version 5.0.0 )
  3. Regenerate your Entities
  4. Make sure you get the <DbProviderFactories> and <providers> sections just like you have.

这篇关于MySQL和asp.net身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆