Tuesday, December 18, 2012 2:14 PM
I have a site that had been successfully deployed on a shared host and up for a few weeks when suddenly I encounter the following.
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8876. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details
For the benefit of all, I've already carried out the following steps:
- Web.config - Removed and Added the System.Data.SqlServerCe.4.0 provider
<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=22.214.171.124, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> </DbProviderFactories> </system.data>
- BIN directory, included the following:
As you can see, all the native DLLs are present.
At the moment, my hypothesis is leaning to the hosters app pool not having sufficient permissions to access the native DLLs. But how is this even possible? The .NET assemblies were able to be loaded without any difficulty.
What are the necessary steps should the hoster take to troubleshoot and identify the cause? Use ProcExp.exe?
The following stackoverflow post points to the fact that the native SQL CE 4.0 components use COM. And recommends using Registration Free COM via manifest files. Is this approach applicable to ASP.net sites? In particular, wouldn't this require ASP.net Web Applications to be built rather than ASP.net Web Sites?
Wednesday, December 19, 2012 8:27 AMModerator
Based on the error message, this issue can occur due to invalid permission, corrupted SQL Server Compact files or wrong ASP.NET settings. First, please refer to the following link to grant permission to application pool to access SQL Server Compact folder. If the issue persists, please reinstall SQL Server Compact 4.0.
Unable to load the native components of SQL Server Compact:
Using SQL Server Compact for ASP.NET Web Applications:
TechNet Community Support
Wednesday, December 19, 2012 10:03 PM
Thank you. The problem was caused by the following:
1. I had a private deployment that used the Desktop DLLs (i.e. Version 126.96.36.199)
2. The hoster subsequently installed SQL Server Compact on the machine, but did not grant Application Pool user to access the SQL Server Compact Edition directory.
3. This caused my application to use the GAC'ed version, and it failed loading native components.
The solution in my case was to
1. redeploy using Private DLLs (i.e. Version 188.8.131.52)
2. update Web.config to refer to Version 184.108.40.206 in <assemblies> and <DbProvider>
- Marked As Answer by teyc Wednesday, December 19, 2012 10:03 PM