How to consume SL/RIA as WCF - wcf-ria-services

Using VS2012 and beginning with a SL Business Application project, I added
an EF model Model1, removed the tt files, changed code gen to Default and built the project. Then I added DomainService1 with various tables. OData was not selected.
Starting the app it appears there is a service available:
But if we click the url, we expect to see XML, and it doesn't work. Appending ?wsdl should cause XML to be sent to the browser, but I just get the illustrated page. Trying it with svcutil as suggested by this page produces this:
Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication
Foundation, Version 4.0.30319.17929] Copyright (c) Microsoft Corporation.
All rights reserved.
Attempting to download metadata from 'http://localhost:57880/Ria1-Web-DomainService1.sv
c?wsdl' using WS-Metadata Exchange or DISCO. Generating files...
Warning: No code was generated. If you were trying to generate a client, this could be
because the metadata documents did not contain any valid contracts or services or
because all contracts/services were discovered to exist in /reference assemblies.
Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to use
the /dataContractOnly option.
This appears to suggest the MEX endpoint isn't properly designed, so out came my WCF books, but there is no correlation between what they think ought to be in <system.serviceModel> and what actually was there:
<system.serviceModel>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
What do I need to add to the config to expose the metadata?

While preparing this question it occurred to me to wonder what happens to the config when you do specify OData. This turned out to be the right question. You get this:
<system.serviceModel>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<domainServices>
<endpoints>
<add name="OData"
type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory,
System.ServiceModel.DomainServices.Hosting.OData,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</endpoints>
</domainServices>
</system.serviceModel>
This gave me a few more search terms. Combining information from various sources led to this:
<add name="Soap"
type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory,
Microsoft.ServiceModel.DomainServices.Hosting,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
which totally failed to work until I added a reference to this:
Whereupon everything lit up and there was much rejoicing.

Related

Database first create entity framework 6.1.1 model using system.data.sqlite 1.0.93

I have a project that I just updated using nuget. This updated entity framework from 6.1 to 6.1.1, and it updated sqlite to 1.0.93. I wanted to update my model from my latest database. I did the steps of
1) Model from Database
2) Select sqlite database
3) Generate
After the generation I received the following error message shown below. I have the 1.0.93 design time components install. Does anyone know what exactly is causing this error. The project references and versions all match the versions shown above.
Error Message:
Your project references the latest Entity Framework; however and Entity Framework database provider
compatible with this version could not be found for you data connection.
Update:
I ended up installing 6.1.0 manually using the package manager console
Install-Package EntityFramework -Version 6.1.0
Then in my csporj files replacing
packages\EntityFramework.6.1.1
with
packages\EntityFramework.6.1.0
I tried creating EF Designer from Database and Code First from Database but I am still getting the same error.
UPDATE
I have followed the instructions Tom has provided, and thanks time for taking the time to respond in depth it is appreciated. But I cannot get the entity framework designer to work with SQLite 1.0.93. What I have found:
1) When I add the SQLite data source from the tools menu as Tom describes I see the SQLite data provider.
2) But when I restart visual studio the data source is not connected
3) The data source can be refreshed and it is valid after restart
4) Add new data item but SQLite is not listed as a provider
I have double checked the registry and EF6 is appended to the invariant name, the SQLite dlls are registered in the GAC. I will try to see what else I can find but at this point I am not sure what to look for. As a side note I have tried dotConnect and it does not work either with EF 6.1.1.
Update 2
Does anyone know if the Entity Framework Designer has a logging option to find out what might be happening?
[ UPDATE : for an easier solution that works with Visual Studio 2013 Update 4 (Pro and Ultimate) and recent versions of Sqlite Providers and EF, look at the solution 'broslav' posted below. Don't know if it works with Express editions... ]
Ok, this is a suggestion. This does NOT work for Visual Studio Express editions.
Also, I'm not sure how to get it to work for an update of an existing project.
And it is an absolute pain in the butt.
I haven't tested if everything is required, but this should work:
First, do NOT use the NuGet package for SQLite, but download the assembly installer from here:
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
Install the Setups for 32-bit Windows (.NET Framework 4.5.1) installer: sqlite-netFx451-setup-bundle-x86-2013-1.0.93.0.exe (10.00 MiB) (NOT the 64-bit version). This is the only one with the designer.
Install and select to install in the GAC and install the Designer for VS13.
For the following, the exact order is important!
I made a video of these steps, see: http://vimeo.com/103372740
Create a project in VS13. Target the build to framework 4.5.1 and x86 explicitly. Save and build.
Next, install the latest EF 6 package (6.1.1) from NuGet. Save and build.
Manually add references to the installed SQLite assemblies (including the Designer) , under the Reference Manager under Assemblies you can find the Extensions option for selecting the four added assemblies in the GAC : System.Data.SQLite Core + Designer + for Entity Framework + for LINQ.. Save and build.
Then create a connection to your database via Connect to Database under Tools. Before you do anything else Save and Build and then RESTART Visual Studio. DO NOT DO ANYTHING ELSE before starting the ADO.NET Entity Data Model wizard, so DO NOT refresh the database connection.
Add an ADO.NET Entity Data Model, select Generate from Database.
Your database connection will show up in the drop-down list. Keep it there, but select to create a New Connection anyway and select the exact same database again (as if you are creating a new connection). It sounds silly, but it is crucial, see image below...
When I actually Added an ADO.NET Entity Data Model this way it did present the annoying error, but the Next button is selectable and everything worked regardless (amazingly)!
Designer works, retrieving data and writing data works.
Haven't tested deployment on another machine though... I'm using Win7 64-bit.
CHANGED UPDATE: To get the correct configuration to actually access the database, you have to install the System.Data.SQLite.EF6 package from NuGet after doing all of the above, then add
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
to the App.Config and remove the other providers and remove everything in between <system.data></system.data>, otherwise you'll get some exception. But note that this means that every time you want to update the EDMX model, you have to change the App.Config invariantName="System.Data.SQLite" to invariantName="System.Data.SQLite.EF6" and vice versa.
** Is this getting ridiculous? Yes, it is! And it gave me quite a headache... **
This is what worked for me:
had Windows 8.1 Pro x64
had VisualStudio 2013 Ultimate Update 4
installed http://system.data.sqlite.org/downloads/1.0.94.0/sqlite-netFx451-setup-bundle-x86-2013-1.0.94.0.exe (in GAC, plus designer)
installed EFTools6.1.2ForVS2013.msi from https://www.microsoft.com/en-us/download/details.aspx?id=40762
in old or new solution/project that targets .NET 4.5.1 and Any CPU installed via NuGet package System.Data.SQLite
added new model from database (I did not see the SQLite provider here until I installed the NuGet package inside the project)
to actually access the data, I had to rearrange the add and remove items inside the DbProviderFactories tag in the app.config
So the packages I had were:
<packages>
<package id="EntityFramework" version="6.1.1" targetFramework="net451" />
<package id="System.Data.SQLite" version="1.0.94.1" targetFramework="net451" />
<package id="System.Data.SQLite.Core" version="1.0.94.0" targetFramework="net451" />
<package id="System.Data.SQLite.EF6" version="1.0.94.0" targetFramework="net451" />
<package id="System.Data.SQLite.Linq" version="1.0.94.1" targetFramework="net451" />
</packages>
and the app.config that worked for me had contents:
<?xml version="1.0" encoding="utf-8"?>
<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=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<system.data>
<!--
NOTE: The extra "remove" element below is to prevent the design-time
support components within EF6 from selecting the legacy ADO.NET
provider for SQLite (i.e. the one without any EF6 support). It
appears to only consider the first ADO.NET provider in the list
within the resulting "app.config" or "web.config" file.
-->
<DbProviderFactories>
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="WorkinDataEntities" connectionString="metadata=res://*/WorkinDataModel.csdl|res://*/WorkinDataModel.ssdl|res://*/WorkinDataModel.msl;provider=System.Data.SQLite.EF6;provider connection string="data source=X:\dev\proj\workin\bin\data.db"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
As you can see, somehow in the end, for me, it was not necessary to remove "EF6" from invariantName or to remove or rearrange other providers or default connection factories. I didn't have to do any reg hacks. Rearranging add/remove tags (that were added during NuGet System.Data.SQLite 1.0.94.1 package installation) in the start-up project's app.config made the difference.
After all the above, I updated EntityFramework to 6.1.2 via NuGet and both updating the model from database via designer and accessing the data at runtime still works.
I finally have steps to consistently add Sqlite and EF6 to a project:
EF6: versions 6.0.0 to be 6.1.3 (currently the latest version).
System.Data.Sqlite: 1.0.93 - 1.0.95 but not 1.0.98 (currently the latest version).
To avoid getting System.Data.Sqlite 1.0.98 , do not install using Nuget Package manager. Manually install System.Data.Sqlite. Unfortunately, http://system.data.sqlite.org/ does not readily list previous downloads.
x86 System.Data.Sqlite 1.093
x64 System.Data.Sqlite 1.093
I use Nuget Package manager and install EF6 and then I manually added System.Data.Sqlite library. I have tried multiple times to use 1.0.98 but I cannot
App.config File
For my implementation, I am working with database first an manually coding the entity data classes
public partial class MyDbContextEF : DbContext
{
public MyDbContext() : base("name=MyDbContext") { }
public DbSet<DataRecord> DataRecords { get; set; }
}
[Table("TableName")]
public class DataRecord
{
[Key]
public Int64 RowID { get; set; }
public string Name { get; set; }
}
I reported this issue and a fix is under way, and a workaround appears to be available (I have not tested it) http://system.data.sqlite.org/index.html/tktview?name=e634e330a6
I had the exact same problem--The model designer wizard was not showing my sqlite db in the dropdown list. I was able to resolve it by fiddling with the sqlite db connection and tables.
0a) I added a connection through the Server Explorer to my sqlite file (the sqlite providers and servers showed in new connection wizard for the Server Explorer but not my edmx Model Wizard)
0b) At this point it was not showing in the edmx Model Wizard still, but did show as a Data Connection in the Server Explorer.
1) I added a table to the sqlite file.
2) I closed the connection to the sqlite db through the Server Explorer
3) I opened the design of my dummy table om the sqlite file through the Server Explorer (thus reinitiating the connection)
4) I tried to "Update Model from Database..." and it was showing in the dropdown list
Another step I did not include above was I created and deleted an .mdf SQL server database New Item... > Database Service.... I did that shortly before trying the above steps. I assume that wouldn't matter but you never know.
Not sure what exactly did it. It seemed a manual disconnect and reconnect through the server explorer made VS "wake up" and display the server in the list. Try fiddling with the connection and tables a bit to see if that wakes something up.
I had this problem as well. The cause was probably that I forgot to tick the visual studio checkbox when installing the system.data.sqlite driver and then installed over that with the checkbox ticked without deinstalling the system.data.sqlite driver first. This how I solved it:
Uninstall the system.data.sqlite driver.
Reboot.
Install the system.data.sqlite driver
Delete the old solution and set it up anew, just like you did (might not be necessary).
Add the ADO.NET entity model (the template was missing for me, this answer helped with that)
The sqlite data source should now be available.

AjaxControlToolkit 7.0123 breaks VS2012 Web Application Project

I have an existing VS2012 web application that has been running fine until I added in the latest AjaxControlToolkit (7.0123). Initially, I found that the installation broke the behaviour of the UpdatePanel - whereas before I could refresh a page after an asynchronous post-back without repeating the operation I found that after installation the refresh would repeat the previous operation (I guess the post-back was no longer asynchronous).
I then noticed that, at some time in the past, I had commented out a number of the default JavaScript files that are added to a new ASP.NET Web Forms Application so I tried adding them back in. This resulted in an exception:
'MsAjaxBundle' is not a valid script name. The name must end in
'.js'.
I then tried replacing the default <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> this resulted in a new exception
Could not load file or assembly 'System.Web' or one of its
dependencies. The system cannot find the file specified.
For sanity, I then created a fresh ASP.NET Web Forms Application (VS2012, Update 2) and ran it. No errors. Using "nuget", I then added the AjaxControlToolkit v7.0123 (the latest release). Ran the application again and I get the original exception again:
'MsAjaxBundle' is not a valid script name. The name must end in
'.js'.
Once again, I replaced <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> and once again this results in
Could not load file or assembly 'System.Web' or one of its
dependencies. The system cannot find the file specified.
Can anybody shed any light on what else I need to do to resolve this? I can find no documentation to say anything needs to be changed manually when adding the toolkit.
Thanks,
Answer found at http://stephenwalther.com/archive/2012/09/20/september-2012-release-of-the-ajax-control-toolkit.aspx (always just after posting the question huh)
Replacing <asp:ScriptManager .../> with <ajaxControlToolkit:ToolkitScriptManager .../> is correct
Need to remove reference to MsAjaxBundle
Need to remove Assembly="System.Web" from script references
This fixes the exceptions (both in the new project and the original).
It does not however resolve the problem with the UpdatePanel no longer posting back asynchronously. I will raise this as a new question.
If you are using the April 2013 Release of the Ajax Control Toolkit see Stephen Walther's latest blog post:
http://stephenwalther.com/archive/2013/04/30/april-2013-release-of-the-ajax-control-toolkit.aspx
I was missing the new web.config settings that allow the AjaxFileUpload control to work in the new release
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" maxRequestLength="42949672" />
<httpHandlers>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295"/>
</requestFiltering>
</security>
</system.webServer>
</configuration>
When you see this "'MsAjaxBundle' is not a valid script name. The name must end in '.js'."
The Best thing you can do is:
Go to the site Master (Double click on it )
Search for "MsAjaxBundle" or " "
Comment this line eg. <%----%>
Save or compile your program and then run it
Thank God is working by now

errors while deploying sql server compact 3.5 sp2 privately

So Ive spent quite some time today with sql lite and saw the .net4 providers were very un stable. So I figured I'll use SqlCE. Its supposed to have a zero config/install instead its the most confusing way to deploy the thing.
I check numerous SO questions and these articles:
Link
Link
A More updated short guide:
http://robindotnet.wordpress.com/2010/02/28/how-to-deploy-the-sqlserver-compact-edition-software-locally/
So here is my problem, without the <runtime> tag bit, it WORKS on my DEV machine but NOT on XPSp3 without the SqlCE runtimes. It gives me a FileIOLoadException
WITH the <runtime> tag it works on XpSp3 but on my dev box it says :
Could not load file or assembly 'System.Data.SqlServerCe, Version=3.5.1.50, 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)
I checked this answer but Im VERY confused. Also, apparently the msdn blog articles are off, you need to include 7 dlls all together. And the System.Data.SqlServerCe.dll and System.Data.SqlServerCe.Entity.dll both come from folder named "Private" where the runtimes are installed.
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.3.5"></remove>
<add name="Microsoft SQL Server Compact Data Provider"
invariant="System.Data.SqlServerCe.3.5"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" culture="neutral"/>
<bindingRedirect oldVersion="3.5.1.0-3.5.1.50" newVersion="3.5.1.50"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
How in the world is this zero configuration!? I have no idea what really is going wrong nor what I did to make it right? Isn't there documentation on this anywhere Other than some old blogs?
Just simply put, once I need to deploy, I just want to be able to xcopy exe and other files and it should work.So where is the reference/msdn/documentation/step-by-step on how to deploy?
Also sqlce will work on a box with ONLY .net4 installed right?
I had a very similar problem posted on S.O. in 6851346, and I just solved it.
I don't know if you are still struggling with this, but I found a solution on Code Project called Creating a Private Installation for SQL Compact that fixed my problems right up.
I hope this helps others, too.
Do you use Entity Framework? If not, the runtime tag is not required.
You must change this: Version=3.5.1.0 (in the add tag) to 3.5.1.50, and make sure you use the System.data.SqlServerCe.dll from the Private folder (it has this special assembly version)

ASP.NET ReportViewer works in development, is empty when deployed

I have a ASP.NET web app that utilizes ReportViewer to show local reports. Everything works beautifully on my development machine (XP Pro, Visual Studio 2008). When I deploy the app to the production server (Windows Server 2008, IIS 7), the site works very well, except for the report viewer. When I generate the report, the report viewer remains empty.
I have written debugging code to verify that the records are being received from the database, and they are. No error occurs but, no records are show in the report viewer. Also, the images that normally appear in the menu bar of the ReportViewer control (export button, print button, forward and back buttons, etc) do not load either.
I ran the ReportViewer.exe on the server to install the appropriate files, and I have verified that they are in the GAC of the machine.
Can anyone suggest a way to debug this...it would be easier if an error was being generated (I can't believe I just said that)?
Please verify that you have the required web.config entries. My suspicion is that you are missing the entry in system.webServer/handlers, which is required in IIS7. IIS7 pretty much ignores the system.web/httpHandlers section, which may explain why it works in IIS 5.1 (XP) but not in 7.
Version numbers may vary, but this should cover it for entries:
In the system.web/compilation section:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
In the system.web/httpHandlers section
<add path="Reserved.ReportViewerWebControl.axd"
verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
And in the system.webServer/handlers section:
<add name="ReportViewer"
path="Reserved.ReportViewerWebControl.axd"
verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
preCondition="integratedMode" />

Can Entity Framework be used to generate SQL Server Compact database

I created a project as described here using Visual Studio 2010 and .NET 4 (Win7/x64). Once I've change the platform target to 'Any CPU' the sample project works. However, if try to generate a model from entity data model (right-click the model and select 'Generate Database from Model'), I get the following error.
Could not find the appropriate DbProviderManifest to generate the SSDL. The supplied provider invariant name 'System.Data.SqlServerCe.3.5' is not valid.
I have a reference to System.Data.SqlServerCe on my project.
I appear to have just fixed
Error 175: The specified store provider cannot be found in the configuration, or is not valid.
when opening the .emdx eitehr as XML or in the designer.
I needed to add the element
<add name="Microsoft SQL Server Compact Data Provider"
invariant="System.Data.SqlServerCe.3.5"
description=".NET Framework Data Provider for Microsoft SQL Server Compact"
type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
To my machine.config as a second entry under <configuration><system.data><DbProviderFactories> (alongside a similar one for SQL Compact V4).
This made it match another system where I wasn't getting error 175.
NB. Adding this to app.config wasn't sufficient for the designer (searching the web indicates this is needed at runtime if the CE 3.5 tools have not been installed).
An update to #Richard 's answer:
In the case of using SQL Server Compact Edition v4.0, you should have the following lines in your machine.config file:
<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"/>
</DbProviderFactories>
</system.data>
It should work, but there are some extra steps that you need to take. See: http://blogs.msdn.com/b/stevelasker/archive/2008/10/22/privately-deploying-sql-server-compact-with-the-ado-net-entity-provider.aspx