DataContractSerializer Error using Entity Framework 4.0 with WCF 4.0

前端 未结 5 1647
灰色年华
灰色年华 2020-12-01 03:14

I am attempting to retrieve a list of objects from Entity Framework via WCF, but am receiving the following exception:

There was an error while trying to serialize p

5条回答
  •  有刺的猬
    2020-12-01 03:51

    For EntityFramework 6.0 I had to change configuration as well:

    public class MyContext : DbContext
    {
        public MyContext() : base("name=MyContext")
        {
            Configuration.ProxyCreationEnabled = false;
        }
    }
    

提交回复
热议问题