The provider did not return a ProviderManifestToken string error

62,046

Solution 1

The problem was with the MySQL connector/Net.

I previously used MySQL connector/Net 6.3.5 and after I uninstalled it and installed MySQL connector/Net 6.5.4 the issue was fixed. You can find latest connectors at http://www.mysql.com/products/connector/

Solution 2

I know this may be very basic for a couple of you guys, but this exception is also thrown in cases where EF is unable to locate a Connection String to use. If you-re working in a multi-layered application, make sure the connection String is added to your client application, instead of the class library that contains you data access code. Just my 2 cents.

Solution 3

I got this error when my sql server was actually down. So, please be sure that your sql server is up and running.

Solution 4

You can also get this error if you upgrade Nuget references in an EntityFramework project that uses MySql.Data.Entity (latest version is 6.10.X) and MySql.Data (latest version is 8.0.X). Those version numbers should match. You should use the MySql.Data.EntityFramework package with MySql.Data version 8.0 and after, and the MySql.Data.Entity package with versions 6.10 and before.

There are a lot more details in this blog post: https://davidsekar.com/asp-net/mysql-error-the-provider-did-not-return-a-providermanifesttoken

Solution 5

Sometimes this issue arises because of sslmode as well, For me the solution was to add sslmode=None to connection string

I had to make a small change to my connection string from

<add name="Connection" connectionString="Server=SOMEHOST;Database=DB;Uid=USR1;Pwd=PASS1;" providerName="MySql.Data.MySqlClient" />

to

<add name="Connection" connectionString="Server=SOMEHOST;Database=DB;Uid=USR1;Pwd=PASS1;sslmode=None;" providerName="MySql.Data.MySqlClient" />
Share:
62,046
har
Author by

har

BSc Engineering (Hons) from Department of Computer Science and Engineering, University of Moratuwa. Selected student for Joomla! Student Outreach Program 2010, Google Summer of Code 2011. Love Open Source and research on Human Computer Interaction &lt;3

Updated on July 05, 2022

Comments

  • har
    har almost 2 years

    I am trying to create a web app using ASP.Net MVC3, Entity Framework and MySQL.

    I have added the following code to my Web.Config file.

    <connectionStrings>
        <add name="ContactContext" connectionString="server=localhost;database=contacts;uid=root;pwd=password;" providerName="MySql.Data.MySqlClient"/>
    
      </connectionStrings>
    

    I also have created "Person" Model , "ContactContext" in the project "Contact_Me". When I try to create a "ContactController" including Person Model and Contact context, it gives me the following error

    "Unable to retrieve metadata for "Connect_Me.Models.Persons". The provider did not return a ProviderManifestToken string"

    MYSQ & MVC3 SQL connection error \ ProviderManifestToken but I am using MySQL, this is the closest question to mine. But the answer didn't solve my problem.

    Thanks in advance

  • har
    har about 12 years
    I tried to log in to the DB instance. It works fine. I also think the problem is with the connection string. Your solution also didn't work.
  • hardba11
    hardba11 over 11 years
    I was getting the error while using the EF Power Tools Reverse engineer (Code First), and your answer was spot on. I had specified the connection in the EF PowerTools, but was missing from the web.config of the destination application. Thanks for this!
  • Ben Messick
    Ben Messick over 10 years
    The exact reason in my case. Thanks, user1843594!
  • dlchambers
    dlchambers almost 9 years
    A malformed conn string causes this as well. Due to a formatting error I had the port in my conn string twice (eg: "server.com:3306:3306") and got this error.
  • ilter
    ilter over 8 years
    You're using a providerName for "MySQL" when using MSSQL.
  • Ajay Suwalka
    Ajay Suwalka almost 6 years
    Sorry, sslmode=None; has to be added
  • sushil suthar
    sushil suthar over 4 years
    Thank you so much, This was exactly my problem and it got solved now.
  • Jules
    Jules over 4 years
    I love you for this answer! Thank you so much.
  • Tim Cooke
    Tim Cooke over 4 years
    It took me a really long time to figure this one out. Glad you guys found it helpful!
  • Keep Thinking
    Keep Thinking about 4 years
    the is my case. It could working fine previously. One day after you installed some software with SSL lib, then program could not connect to mysql without any info about SSL. Because default value of sslmode is preferred.