Reputation: 1143
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.
Upvotes: 23
Views: 77467
Reputation: 1
..and FINALLY(?!?) don't forget to build your project with 'Prefer 32-bit' checked as this will eliminate the KNOWN BUG which generates this error message (which has the inner exception message = 'Arithemtic overflow')
Upvotes: 0
Reputation: 312
I often forget why this error comes often. For me its usually I have changed credential of the database and did not change the same on the code section. Just in case if I come here again to remind myself.
Upvotes: 0
Reputation: 8926
For those getting this recently, in updating to MySql.Data 8.0.19 you also have to update your references for EntityFramework, Oracle changed the package, it's now MySql.Data.EntityFramework instead of MySql.Data.Entity or MySql.Data.Entities. Props to David Sekar: https://davidsekar.com/asp-net/mysql-error-the-provider-did-not-return-a-providermanifesttoken
Upvotes: 3
Reputation: 11
For me, It was all of the below. 1. DB not allowed to connect to my dev environment. May be firewall restrictions. 2. Connection string had wrong credentials for the DB. So generally speaking, incorrect connection string.
Upvotes: 1
Reputation: 166
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
Upvotes: 7
Reputation: 13278
For me, it was using double backslash between the server and the instance, such like .\SQLExPRESS;...etc.
The correction was to use .\SQLEXPRESS
hope it helps someone.
Upvotes: 0
Reputation: 51
I had the same problem, reinstalling Npgsql with the package manager did the trick. Seemed to be a versionning problem.
Upvotes: 0
Reputation: 469
In my case the paramter was v12.0, I changed to v11.0 and it is working
Upvotes: 0
Reputation: 3752
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.
Upvotes: 4
Reputation: 123
i meet this problem when i try to connect to mysql, the reason is that i forget to add the "password" in "connectionStrings"
Upvotes: 0
Reputation: 35410
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.
Upvotes: 11
Reputation: 1143
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>
Upvotes: 4