Entity Framework: “ProviderName” in connection string required- all of the sudden?

纵然是瞬间 提交于 2019-11-28 12:01:02

Certain driver combinations will cause the machine to be in a state where it is ambiguous which driver it should use, so it requires an explicit provider name.

It was probably some other separate application or driver install, or automatic Windows Update that ran.

Being explicit with the provider name doesn't hurt anything though. You should be fine adding it; it's only a few extra characters in your connection string. It won't ever need to change in the future or anything.

Your updated declaration should read:

<connectionStrings>
  <add
    name="MyConnectionStringName"
    connectionString="Connection string goes here"
    providerName="System.Data.SqlClient" />
</connectionStrings>

You can use too:

providerName="System.Data.EntityClient"

then:

<add name="name_here" connectionString="Data Source="pathofdatabase" providerName="System.Data.EntityClient" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!