Could not load file or assembly System.Data.SqlServerCe
Hello,
I've got an Umbraco v6 site which works local, but the website doesn't work on the staging server. I'm getting the following error:
Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
System.Reflection.RuntimeAssembly.GetExportedTypes() +122
Umbraco.Core.TypeFinder.GetTypesWithFormattedException(Assembly a) +199
Umbraco.Core.TypeFinder.GetTypes(Type assignTypeFrom, IEnumerable`1 assemblies, Boolean onlyConcreteClasses) +161
Umbraco.Core.PluginManager.LoadViaScanningAndUpdateCacheFile(TypeList typeList, TypeResolutionKind resolutionKind, Func`1 finder) +53
Umbraco.Core.PluginManager.ResolveTypes(Func`1 finder, TypeResolutionKind resolutionType, Boolean cacheResult) +1373
Umbraco.Web.WebBootManager.InitializeApplicationEventsResolver() +76
Umbraco.Core.CoreBootManager.Initialize() +565
Umbraco.Web.WebBootManager.Initialize() +51
Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +100
[HttpException (0x80004005): Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3985477
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
[HttpException (0x80004005): Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11524352
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4782309
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Is there anything I need to do for sql ce on the server?
You should have the following entry in your web.config - under <system.data> <DbProviderFactories>
<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.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
Check that the version of System.Data.SqlServerCe.dll in the bin folder corresponds to the version specfied in the above section.
It redirects to 4.0.0.1, while the assembly version of 4.0.0.1 states it's version 4.0.0.0. Kind of weird stuff is going on with SQL CE and versioning.
Just try this and Morten's suggestion and you'll get it fixed I guess :-)
Could not load file or assembly System.Data.SqlServerCe
Hello,
I've got an Umbraco v6 site which works local, but the website doesn't work on the staging server. I'm getting the following error:
Is there anything I need to do for sql ce on the server?
Jeroen
Btw I'm not even using sql ce so I don't even need it.
Jeroen
You should have the following entry in your web.config - under <system.data> <DbProviderFactories>
Check that the version of System.Data.SqlServerCe.dll in the bin folder corresponds to the version specfied in the above section.
- Morten
Also had some sites where I had to add this to the web.config:
It redirects to 4.0.0.1, while the assembly version of 4.0.0.1 states it's version 4.0.0.0. Kind of weird stuff is going on with SQL CE and versioning.
Just try this and Morten's suggestion and you'll get it fixed I guess :-)
I was missing the System.Data.SqlServerCe.dll file in the bin folder. Strange that it works local without that dll, but it's fixed now. Thanks :-).
Jeroen
Nah, you probably have SqlCE installed in the GAC on your machine.
is working on a reply...