EF& WCF错误 - SQL Server Compact不适用于ASP.NET开发 [英] EF & WCF error - SQL Server Compact is not intended for ASP.NET development

查看:92
本文介绍了EF& WCF错误 - SQL Server Compact不适用于ASP.NET开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的wpf应用程序设置来消耗我在另一个项目中运行的测试wcf服务。该服务从使用实体框架附加到wcf服务项目的sql compact 3.5 sdf中检索几行。



我得到SQL Server Compact不适用于ASP。 NET开发。一旦我尝试并运行其中一项服务,就会在服务项目中的对象上下文类的第一行出现错误。



这个错误据说可以被抑制AppDomain.CurrentDomain.SetData(SQLServerCompactEditionUnderWebHosting,true);在global.asmx文件中。但是这不是一个asp.net项目,所以没有global.asmx。



我应该把这一行放在哪里?或者是不是为EF和WCF设计的SQL CE 3.5?

解决方案

您应该将该行作为第一个执行代码。如果它是一个普通的控制台/ winform / wpf应用程序,只需将其放在Porgram.cs文件中的main()函数的第一行。



更好的解决方案可能是升级到 v4.0 ,根本不会产生此错误。


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

Im getting the "SQL Server Compact is not intended for ASP.NET development." error on the 1st line of the of my object context class in the service project as soon as I try and run one of the services.

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

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

解决方案

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.

这篇关于EF& WCF错误 - SQL Server Compact不适用于ASP.NET开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆