1

I getting error on server while running "Failed to find or load the registered .Net Framework Data Provider.". I have Sql Compact 4 database included to ASP.NET MVC 4 + Entity Framework, uploading on godaddy server... web.config is following

Web.Config

<?xml version="1.0" encoding="utf-8"?>
<!--
 For more information on how to configure your ASP.NET application, please visit
 http://go.microsoft.com/fwlink/?LinkId=169433
 -->
<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=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
 </configSections>
 <connectionStrings>
 <add name="EShip" connectionString="Data Source=|DataDirectory|\EShip.sdf" providerName="System.Data.SqlServerCe.4.0" />
 </connectionStrings>
 <appSettings>
 <add key="webpages:Version" value="2.0.0.0" />
 <add key="webpages:Enabled" value="false" />
 <add key="PreserveLoginUrl" value="true" />
 <add key="ClientValidationEnabled" value="true" />
 <add key="UnobtrusiveJavaScriptEnabled" value="true" />
 </appSettings>
 <system.web>
 <compilation debug="true" targetFramework="4.0" />
 <customErrors mode="Off"/>
 <pages>
 <namespaces>
 <add namespace="System.Web.Helpers" />
 <add namespace="System.Web.Mvc" />
 <add namespace="System.Web.Mvc.Ajax" />
 <add namespace="System.Web.Mvc.Html" />
 <add namespace="System.Web.Optimization" />
 <add namespace="System.Web.Routing" />
 <add namespace="System.Web.WebPages" />
 </namespaces>
 </pages>
 </system.web>
 <system.webServer>
 <validation validateIntegratedModeConfiguration="false" />
 <modules runAllManagedModulesForAllRequests="true" />
 <handlers>
 <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
 <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
 <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
 <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
 <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
 <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
 </handlers>
 </system.webServer>
 <entityFramework>
 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
 <parameters>
 <parameter value="v11.0" />
 </parameters>
 </defaultConnectionFactory>
 </entityFramework>
 <runtime>
 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
 <dependentAssembly>
 <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
 <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
 </dependentAssembly>
 <dependentAssembly>
 <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
 <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
 </dependentAssembly>
 <dependentAssembly>
 <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
 <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
 </dependentAssembly>
 </assemblyBinding>
 </runtime>
 <system.data>
 <DbProviderFactories>
 <remove invariant="System.Data.SqlServerCe.4.0"/>
 <add name="Microsoft SQL Server Compact Data Provider 4.0"
 invariant="System.Data.SqlServerCe.4.0"
 description=".NET Framework Data Provider for Microsoft SQL Server Compact"
 type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.1, 
 Culture=neutral, 
 PublicKeyToken=89845dcd8080cc91"/>
 </DbProviderFactories>
 </system.data>
</configuration>

[/xml]

asked Jan 12, 2013 at 5:08
2
  • 1
    Try to change "System.Data.SqlServerCe, Version=4.0.0.1" to "System.Data.SqlServerCe, Version=4.0.0.0" Commented Jan 12, 2013 at 7:32
  • 2
    Solved by install-Package EntityFramework.SqlServerCompact Commented Jul 5, 2013 at 7:14

2 Answers 2

1

Using the comment of the OP, I have a slightly more verbose version.

With nuget in hand, one can run the command

install EntityFramework.SqlServerCompact

to download SqlServerCompact When I try that, I see 3 dependencies come along with that so you get 4 installs in total:

  • Microsoft.SqlServer.Compact
  • SqlServerCompact
  • EntityFramework
  • EntityFramework.SqlServerCompacy

It can therefore be inferred that a likely cause of running into this problem is missing SqlServerCompact for your installation.

0

I had a similar problem with a simple test app.

Install-Package EntityFramework.SqlServerCompact got rid of the message 'Failed to find or load the registered .Net Framework Data Provider' by adding SqlServer Compact dlls to the app 'packages' directory. It added the following to the packages.config;

<?xml version="1.0" encoding="utf-8"?>
<packages>
 <package id="EntityFramework" version="5.0.0" targetFramework="net40-Client" />
 <package id="EntityFramework.SqlServerCompact" version="4.3.6" targetFramework="net40-Client" />
 <package id="Microsoft.SqlServer.Compact" version="4.0.8876.1" targetFramework="net40-Client" />
 <package id="SqlServerCompact" version="4.0.8854.1" targetFramework="net40-Client" />
</packages>

It also added System.Data.SqlServerCe and System.DataSqlServerCe.Entity to the app references.

I then got an exception like this;

System.IO.FileLoadException was unhandled
 Message=Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
 Source=mscorlib
 FileName=System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91
 FusionLog==== Pre-bind state information ===
LOG: User = mulcahy\mulcahy_admin
LOG: DisplayName = System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91
 (Fully-specified)
LOG: Appbase = file:///C:/Users/mulcahy_admin/Dropbox/projects/ons/CSLCE4CL/CSLCE4CL/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\mulcahy_admin\Dropbox\projects\ons\CSLCE4CL\CSLCE4CL\bin\Debug\CSLCE4CL.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.0.1 redirected to 4.0.0.1.
LOG: Post-policy reference: System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: Attempting download of new URL file:///C:/Users/mulcahy_admin/Dropbox/projects/ons/CSLCE4CL/CSLCE4CL/bin/Debug/System.Data.SqlServerCe.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

This seems to suggest that the app is configured to use SqlServerCE v4.0.0.1 - but finds v4.0.0.0

So i used Eriks suggestion and changed the DbProviderFactories entry to say v4.0.0.0 and removed the bindingRedirect entry that refered to a new version at v4.0.0.1.

This seems to work. Hope it helps anyone following this path...

Meanwhile I'm a bit puzzled;

  1. Why is the System.Data.SqlServerCe.dll at version 4.0.8876.1 - how could I know that this is actually v4.0.0.0
  2. Where did the v4.0.0.1 reference come from - I must have this version somewhere on my machine?
nhahtdh
56.9k15 gold badges131 silver badges164 bronze badges
answered Sep 18, 2013 at 11:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.