EF& WCF错误 - SQL Server Compact不适用于ASP.NET开发 [英] EF & WCF error - SQL Server Compact is not intended for ASP.NET development
问题描述
我得到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屋!