EF & WCF error - SQL Server Compact is not intended for ASP.NET development

萝らか妹 提交于 2019-12-05 14:03:24

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

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

I know this is old post but this line of code help me to resolve the issue:

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

in your Global.asax

Try this :

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


}

SQL Server Compact 3.5 is not supported with applications hosted under ASP.NET, use version 4.0 instead. It does not require this property to be set, and is tested and supported with ASP.NET

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!