你好傢伙我正在努力連接到SQL數據庫服務器。我正在使用Entity framework v6並首次嘗試使用代碼優先方法。下面我會告訴你我的app.config
文件和錯誤消息我得到我檢查了類似的問題和答案,大部分都是關於失蹤EntityFramework.SqlServer.dll
我有這個dll引用實體框架提供程序錯誤
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="HotelDB"
connectionString="Data Source=(localdb)\v11.0;Initial Catalog=master;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"/>
</connectionStrings>
</configuration>
錯誤消息:
System.InvalidOperationException :未找到具有不變名稱「System.Data.SqlClient」的ADO.NET提供程序的實體框架提供程序。確保提供程序在應用程序配置文件的'entityFramework'部分中註冊。有關更多信息,請參見http://go.microsoft.com/fwlink/?LinkId=260882。
請不要發佈相同的答案多個問題發表一個很好的答案,然後投票/標記將其他問題作爲重複項目關閉。如果問題不是重複的,*定製你對問題的答案。* –