简体   繁体   English

提供程序未返回 ProviderManifestToken 字符串错误

[英]The provider did not return a ProviderManifestToken string error

I am trying to create a web app using ASP.Net MVC3, Entity Framework and MySQL.我正在尝试使用 ASP.Net MVC3、Entity Framework 和 MySQL 创建一个 Web 应用程序。

I have added the following code to my Web.Config file.我已将以下代码添加到我的 Web.Config 文件中。

<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".我还在“Contact_Me”项目中创建了“Person”模型、“ContactContext”。 When I try to create a "ContactController" including Person Model and Contact context, it gives me the following error当我尝试创建包括人员模型和联系人上下文的“ContactController”时,它给了我以下错误

"Unable to retrieve metadata for "Connect_Me.Models.Persons". The provider did not return a ProviderManifestToken string" “无法检索“Connect_Me.Models.Persons”的元数据。提供程序未返回 ProviderManifestToken 字符串”

MYSQ & MVC3 SQL connection error \\ ProviderManifestToken but I am using MySQL , this is the closest question to mine. MYSQ & MVC3 SQL connection error \\ ProviderManifestToken 但我使用的是 MySQL ,这是最接近我的问题。 But the answer didn't solve my problem.但答案并没有解决我的问题。

Thanks in advance提前致谢

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.我知道这对于你们中的一些人来说可能是非常基本的,但是在 EF 无法找到要使用的连接字符串的情况下也会抛出这个异常。 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.只有我的 2 美分。

I got this error when my sql server was actually down.当我的 sql server 实际关闭时,我收到了这个错误。 So, please be sure that your sql server is up and running.因此,请确保您的 sql server 已启动并正在运行。

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 ).如果您在使用MySql.Data.Entity (最新版本为6.10.XMySql.Data (最新版本为8.0.X )的 EntityFramework 项目中升级 Nuget 引用,您也会收到此错误。 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.您应该将MySql.Data.EntityFramework包用于MySql.Data 8.0 及更高版本,以及MySql.Data.Entity包用于 6.10 及MySql.Data.Entity版本。

There are a lot more details in this blog post: https://davidsekar.com/asp-net/mysql-error-the-provider-did-not-return-a-providermanifesttoken这篇博文中有更多细节: https : //davidsekar.com/asp-net/mysql-error-the-provider-did-not-return-a-providermanifesttoken

The problem was with the MySQL connector/Net.问题出在 MySQL 连接器/网络上。

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.我以前使用过 MySQL 连接器/Net 6.3.5,在我卸载它并安装 MySQL 连接器/Net 6.5.4 后,问题得到了解决。 You can find latest connectors at http://www.mysql.com/products/connector/您可以在http://www.mysql.com/products/connector/找到最新的连接器

Sometimes this issue arises because of sslmode as well, For me the solution was to add sslmode=None to connection string有时这个问题也是由于 sslmode 而出现的,对我来说,解决方案是将 sslmode=None 添加到连接字符串

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" />

May be the error is in your connection string.可能是错误在您的连接字符串中。 Have you tried to connect to your DB instance using the above log in. try changing the connection string您是否尝试使用上述登录连接到您的数据库实例。尝试更改连接字符串

connectionString="Data Source=.;Initial Catalog=contacts;Integrated Security=True uid=root;pwd=password;" providerName="MySql.Data.MySqlClient"/>

use above if you are using sql server, else if you are using sql express use below one如果您使用的是 sql server,请使用上面的,否则如果您使用的是 sql express,请使用下面的一个

 connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=contacts;Integrated Security=True uid=root;pwd=password;" providerName="MySql.Data.MySqlClient"/>

Even though this is answered, but I have experienced the same problem and my in case it was in the connection string;即使这是回答了,但我也遇到了同样的问题,以防万一它出现在连接字符串中; I had the part "Integrated Security" when I really shouldn't have used it;当我真的不应该使用它时,我有“集成安全”部分; I was relying on the database authentication.我依赖于数据库身份验证。

I removed the "Integrated Security=True" part and it worked perfectly :)我删除了“Integrated Security=True”部分,它工作得很好:)

Restarting the computer worked for me.重新启动计算机对我有用。

While this message was showing, I did not find any differences between my computer [Windows 10] and the test server where the the application was deployed with the same configuration and was working correctly there and using the same database.在显示此消息时,我没有发现我的计算机 [Windows 10] 与使用相同配置部署应用程序并且在那里正常工作并使用相同数据库的测试服务器之间存在任何差异。 It means the issue was probably not connected to the database running on the test server.这意味着问题可能未连接到测试服务器上运行的数据库。

Worth mentioning is there were some Windows updates pending while restarting.值得一提的是,重新启动时有一些 Windows 更新未决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “提供者没有返回带有Entity Framework的ProviderManifestToken字符串”MySQL - “The provider did not return a ProviderManifestToken string” MySQL with Entity Framework SQL Server未返回响应错误 - SQL Server did not return a response error MYSQ &amp; MVC3 SQL 连接错误 \ ProviderManifestToken 但我使用的是 MySQL - MYSQ & MVC3 SQL connection error \ ProviderManifestToken but I am using MySQL 如何在 Spring 引导时避免此错误:(查询未返回唯一结果:4) - How to avoid this error on Spring Boot: (query did not return a unique result: 4) 收到“查询未返回唯一结果”错误。 我该如何解决? - Getting an "query did not return a unique result" error. How can I fix it? 查询未返回所有行 - Query did not return all rows Flask应用程序中的“视图功能未返回有效响应。”错误在哪里? - Where is the “The view function did not return a valid response.” error in my Flask app? 错误在哪里?“视图函数未返回有效响应。 ”在我的烧瓶应用程序中? - Where is the error “The view function did not return a valid response. ” in my flask app? 连接字符串错误。 找不到请求的 .Net Framework 数据提供程序 - Connection String Error. Unable to find the requested .Net Framework Data Provider SQL查询未返回任何值 - SQL query did not return any values
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM