实体框架中的System.Data.ProviderIncompatibleException [英] System.Data.ProviderIncompatibleException in Entity Framework

查看:223
本文介绍了实体框架中的System.Data.ProviderIncompatibleException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的连接字符串中是否缺少任何东西,所以我收到此错误:

Is there any thing missing in my connection string so that i am getting this error:


类型为'System.Data的异常 .ProviderIncompatibleException在EntityFramework.dll中发生,但未在用户代码中处理。其他信息:从数据库获取提供者信息时发生错误。这可能是由于Entity Framework使用了错误的连接字符串引起的。检查内部异常以获取详细信息,并确保连接字符串正确。

An exception of type 'System.Data.ProviderIncompatibleException' occurred in EntityFramework.dll but was not handled in user code Additional information: 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.

这是我在web.config中的连接字符串:

This is my connection String in web.config:

<connectionStrings>
    <add name="OnlineStoreEntities" connectionString="Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=MVCOnlineShop;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="MVCOnlineShop" connectionString="metadata=res://*/Models.ShopModel.csdl|res://*/Models.ShopModel.ssdl|res://*/Models.ShopModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=AHMADZAKARIA-PC;initial catalog=MVCOnlineShop;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>


推荐答案

检查中的连接字符串* .config 文件,很可能您缺少了 providerName = System.Data.SqlClient 。请参阅实体框架配置文件设置以了解相关信息更多信息

Check your connection string in *.config file and most probably you are missing the providerName="System.Data.SqlClient". See Entity Framework Config File Settings for more information

这篇关于实体框架中的System.Data.ProviderIncompatibleException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆