Home Using MySQL the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' is either not registered in the machine or application config file
Reply: 0

Using MySQL the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' is either not registered in the machine or application config file

faisal
1#
faisal Published in 2017-09-14 10:10:49Z

I am working on creating Rest API using the visual studio in asp.net MVC. The database I am using is MySQL. I am getting below error while running the API.

Severity    Code    Description Project File    Line    Suppression State
Error       Error 175: The ADO.NET provider with invariant name 'MySql.Data.MySqlClient' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.   DataAccess  D:\Work\DOT NET API\RestWithMySQL\DataAccess\ProductsModel.edmx 7

I have two projects in my single solution. Data Access project in which I have added the model and RestWithMySQL project in which I have added my control and the model is added as a reference in it.

When I click on the error I am redirected to the following section

<edmx:StorageModels>
  <Schema Namespace="ProductsModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.5" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
    <EntityType Name="product">
      <Key>
        <PropertyRef Name="Id" />
      </Key>
      <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
      <Property Name="Name" Type="varchar" MaxLength="100" />
      <Property Name="Price" Type="int" />
      <Property Name="Category" Type="varchar" MaxLength="100" />
    </EntityType>
    <EntityContainer Name="ProductsModelStoreContainer">
      <EntitySet Name="product" EntityType="Self.product" Schema="accurate_dev" store:Type="Tables" />
    </EntityContainer>
  </Schema>
</edmx:StorageModels>

My config file is below

<connectionStrings>
<!--<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-RestWithMySQL-20170911031521.mdf;Initial Catalog=aspnet-RestWithMySQL-20170911031521;Integrated Security=True" providerName="System.Data.SqlClient" />-->
<add name="ProductEntities" connectionString="metadata=res://*/ProductsModel.csdl|res://*/ProductsModel.ssdl|res://*/ProductsModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot; Server=localhost; Uid=root; Database=accurate_dev; Port=3306;SslMode=Preferred" providerName="MySql.Data.MySqlClient" />
 <!--<remove name="LocalMySqlServer" /><add name="ProductEntities" connectionString="metadata=res://*/ProductsModel.csdl|res://*/ProductsModel.ssdl|res://*/ProductsModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot; Server=localhost;Uid=root;Pwd=;Database=accurate_dev;" providerName="MySql.Data.MySqlClient" />-->

I have searched for every solution related to it but still can't able to get the desired result.

Any help would be highly appreciated.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.365193 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO