Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The provider did not return a ProviderManifestToken string Entity Framework

An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.

Inner Exception: {"The provider did not return a ProviderManifestToken string."}

I've searched other threads as there are many with similar errors, but I cannot seem to find a solution.

I am using VS2012 Professional and SQL Server 2012. I am able to connect to the server using Server explorer using windows authentication. I am building a webforms application with multiple tiers. One of them containing my Entity framework tier which contains my Context class.

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>

  <connectionStrings>
    <add name="MYSQLSERVER"
         providerName="System.Data.SqlClient"
         connectionString="Data Source=myComputer\MYSQLSERVER;Trusted_Connection=true"></add>
  </connectionStrings>
</configuration>

This is what the app.config in my Entity Framework class library layer looks like.

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

Also, I have tried changing the app.config defaultConnectionFactory type to

<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">

but it did not change anything.

I am not really sure what any of the changes I am making even mean which worries me. Sure I could of found the solution online and fixed my issue, but I would really like to understand the web.config and what this all means. On top of finding a solution to this problem, can anyone point me in the right direction to learning web.configs?

Thank ahead for your help.

like image 564
Leyth G Avatar asked Sep 23 '13 18:09

Leyth G


4 Answers

In my case, it was my SQL Server instance that was not running. I simply started the service and everything worked fine. Hope this helps someone down the road.

like image 65
dotNET Avatar answered Nov 14 '22 07:11

dotNET


I also faced to this error and I solve that downgrading these NuGet packages

MySql.Data - 6.9.12

MySQL.Data.Entity - 6.8.8

this is my reference URL which I referred

like image 44
kgdc Avatar answered Nov 14 '22 07:11

kgdc


Well I fixed it.

Just needed to put "." for localmachine in the data source as follows:

<add name="MYSQLSERVER"
     providerName="System.Data.SqlClient"
     connectionString="Data Source=.\MYSQLSERVER;Trusted_Connection=true"></add>    
</connectionStrings>
like image 4
Leyth G Avatar answered Nov 14 '22 08:11

Leyth G


Here's another possible cause:
I have both my (ASP.NET) HTTP server and MySQL/Aurora server on AWS (understood that AWS was not part of the OP's comments).
My desktop's (actually, our building's) IP was whitelisted in the MySQL/Aurora server's security group, so everything worked perfectly for development.
But the ASP.NET server's IP was not whitelisted for the MySQL/Aurora instance, thus the ASP server's EF connection request was being rejected, and that was causing the exception noted at the top of this thread.
Esoteric, but maybe this helps someone.

like image 4
dlchambers Avatar answered Nov 14 '22 08:11

dlchambers