提供程序未返回ProviderManifestToken字符串实体框架

Ley*_*h G 18 c# sql entity-framework visual-studio visual-studio-2012

从数据库获取提供程序信息时发生错误.这可能是由实体框架使用不正确的连接字符串引起的.检查内部异常以获取详细信息,并确保连接字符串正确.

内在例外: {"The provider did not return a ProviderManifestToken string."}

我搜索过其他线程,因为有很多类似的错误,但我似乎无法找到解决方案.

我正在使用VS2012 Professional和SQL Server 2012.我可以使用Windows身份验证使用Server explorer连接到服务器.我正在构建一个具有多层的webforms应用程序.其中一个包含我的Entity框架层,其中包含我的Context类.

<?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>
Run Code Online (Sandbox Code Playgroud)

这就是我的Entity Framework类库层中的app.config.

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>
Run Code Online (Sandbox Code Playgroud)

此外,我已尝试将app.config defaultConnectionFactory类型更改为

<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
Run Code Online (Sandbox Code Playgroud)

但它没有改变任何东西.

我不确定我所做的任何改变甚至意味着让我担心.当然,我可以在线找到解决方案并修复我的问题,但我真的很想了解web.config以及这一切意味着什么.除了找到解决这个问题的方法之外,还有人能指出我正确的方向来学习web.configs吗?

谢谢你的帮助.

dot*_*NET 10

就我而言,我的SQL Server实例没有运行.我只是启动了服务,一切正常.希望这有助于有人在路上.


小智 7

我也遇到了这个错误,我解决了降级这些 NuGet 包的问题

MySql.Data - 6.9.12

MySQL.Data.Entity - 6.8.8

这是我参考网址我所提到的