0

I've been trying to implement the wonderful SqlCe 4.0 Membership Provider by ErikEJ but I'm having trouble. I got it working via the documentation mr EJ provides. But....

I want to abstract the source into an external DAL. But I'm having issues getting there. The first problem I'm getting is trying to add the reference to SqlCe via the .csproj file rather than the web.config. (I need to do this so I can add the same reference in my DAL project) (I also need to be able to set copy local to true so want it in the csproj references). So I do this....

<assemblies>
   <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <!--<add assembly="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>-->
</assemblies>

And then add it in my project...

SqlReference

But when I browse to the website I get this error message:

Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.

When I refer to the KB article it says:

FIX: You receive an error message when you run a SQL Server Compact 3.5-based application after you install the 32-bit version of SQL Server Compact Edition 3.5 Service Pack 2 on an x64 computer

And yeah that's whats throwing me. Why is it talking about 3.5? I have added a reference to the 4.0 dll which Eric's provider is designed to work with.

I really hope someone can help. Perhaps Erik will read this post :-)

p.s. I'm also wondering what the difference between adding a reference in the web.config and adding it it via the csproj actually is. I thought it was because the web.config looks in the GAC. But when I try to add a reference in visual studio (to the csproj) i cant see the option to add System.Data.SqlServerCe at all!

I can also say that when I copy the dlls directly from

C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Private

Into my DAL bin and website bin and reference them directly in the CSproj I still get the same issue.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Exitos
  • 29,230
  • 38
  • 123
  • 178

1 Answers1

1

You are using the Private assembly version (4.0.0.1) - sounds like the required unmanaged DLL files are missing from your deployed site. Could you have a look in file explorer and show what you see. Also, see this SO answer: Can't get sql server compact 3.5 / 4 to work with ASP .NET MVC 2

Community
  • 1
  • 1
ErikEJ
  • 40,951
  • 5
  • 75
  • 115
  • Hi Erik I followed your link and it worked. Seemed like bascially I needed the myapp\bin\x86 and myapp\bin\amd64 folder from the C:\Program Files\Microsoft SQL Server Compact Edition\v4.0\Private folder. Ive posted up a new question because id like to know the difference between adding in web.config and Csproj. The post is http://stackoverflow.com/questions/8268679/what-is-the-difference-between-adding-a-reference-to-a-gac-dll-in-csproj-and-add, thanks! – Exitos Nov 25 '11 at 11:49
  • It is not the same dll version you are referring to: 4.0.0.0 in web.config and 4.0.0.1 (according to your own screen shot) – ErikEJ Nov 25 '11 at 11:55