EF and WCF error - SQL Server Compact is not designed for ASP.NET development

Hi, I have a simple wpf application setup to use my wcf test service running in another project. The service retrieves multiple rows from sql compact 3.5 sdf attached to a wcf service project using the Entity Framework.

Im getting "SQL Server Compact is not designed for ASP.NET development." an error in the 1st line of the object context class in the service project as soon as I try to start one of the services.

This error can supposedly be suppressed using "AppDomain.CurrentDomain.SetData (" SQLServerCompactEditionUnderWebHosting ", true); in the global.asmx file. However, this is not an asp.net project, so there is no global.asmx.

Where should I put this line? or is SQL CE 3.5 not intended for EF and WCF?

+3
source share
4 answers

You should put the line as the first execution code. If this is a regular console / winform / wpf application, just put it on the first line of the main () function in the Porgram.cs file.

A better solution would be to upgrade to v4.0 , which does not generate this error at all.

+1
source

SQL Server Compact 3.5 is not supported by applications hosted under ASP.NET, use version 4.0 instead. It does not require setting this property and is verified and supported using ASP.NET

0
source

, , :

 protected void Application_Start(object sender, EventArgs e)
 {
     AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
 }

Global.asax

0
source

Try the following:

public partial class Startup
{
    public void Configuration(IAppBuilder app)
    {
        ConfigureAuth(app);
        AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
    }


}
0
source

Source: https://habr.com/ru/post/1780973/


All Articles