开发者

DataContractSerializer leaking memory until process die

开发者 https://www.devze.com 2022-12-15 07:46 出处:网络
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 mem

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

精彩评论

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