1. 程式人生 > >無法為具有固定名稱“System.Data.SqlClient”的 ADO.NET 提供程式載入在應用程式配置檔案中註冊的實體框架提供程式型別“System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer”。請

無法為具有固定名稱“System.Data.SqlClient”的 ADO.NET 提供程式載入在應用程式配置檔案中註冊的實體框架提供程式型別“System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer”。請

Windows服務中程式釋出之後會如下錯誤:

無法為具有固定名稱“System.Data.SqlClient”的 ADO.NET 提供程式載入在應用程式配置檔案中註冊的實體框架提供程式型別“System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer”。請確保使用限定程式集的名稱且該程式集對執行的應用程式可用。有關詳細資訊,請參閱 http://go.microsoft.com/fwlink/?LinkId=260882。

發生原因缺少對:EntityFramework.SqlServer.dll 檔案的引用。

解決辦法:使用nuget新增EntityFramework後將EntityFramework.SqlServer.dll 檔案複製到釋出資料夾後即可。