WCF http binding

前端 未结 1 593
情歌与酒
情歌与酒 2020-12-18 13:53

I create a wcf service application and a asp.net mvc project(as client). I added my wcf service via Add Service Reference file to my asp.net mvc reference. I use Entity Fram

相关标签:
1条回答
  • 2020-12-18 14:14

    I think this issue is an Entity Framework matter. Whenever you serialize an entity in WCF service, it tries to load child entities as well, while WCF can't serialize them. To solve this issue simply disable Proxy Creation option in DbContext constructor:

    public class DatabaseEntities : DbContext
    {
        public DatabaseEntities()
        {
            Configuration.ProxyCreationEnabled = false;
        }
    }
    
    0 讨论(0)
提交回复
热议问题