开发者

DataContractSerializer leaking memory until process die

I have a .net4 application using EF4, I Expose my model through WCF using BasicHttpBinding (but this can be changed) that every time I try invoke this method my web server process start to grow in memory and the process die.

The problem is when the DataContractSeralizer tryi开发者_运维技巧ng to serialize my Entity (has some relationships) enter in a recursive stack. So, Is there any special configuration or something that i'm missing in order to server this Entity through WCF.

Here some extra information: Screenshot of my EF model: http://www.luisguerrero.net/stackoverflow/efmodel.jpg

public List<ExtendedSession> GetAllExtendedSessionByFilter(int id)
{
        QueryDataAccess<ExtendedSession, NextWebEntities> query = new QueryDataAccess<ExtendedSession, NextWebEntities>("ExtendedSession");
        List<ExtendedSession> result = query.GetAllByFilter(item => item.SessionId == id, "Rule");
        return result;
}


I generally solve this by serializing a projection of the data without any circular references, written as a LINQ query.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜