I need help solving a rather weird error in a WCF service.
Posted
by Moulde
on Stack Overflow
See other posts from Stack Overflow
or by Moulde
Published on 2010-03-28T17:17:51Z
Indexed on
2010/03/28
17:23 UTC
Read the original article
Hit count: 207
Hi..
I have a solution that contains three projects. A main project with my MVC app, a silverlight application and a (silverlight enabled) WCF service project.
In my silverlight project i have made a Service Reference to my WCF service. And i pretty much got that working.
In my WCF service i have a method that returns an Book object, which got some random fields like title, date etc. In the book class, i have a ICollection field that contains a list of events.
The book class is generated using entity framework 4.0, and Lazy Loading is enabled.
If i in my getBook(int id) method return a book with the events field not initialized, it works as a charm.
But if i initialize the field, i'm getting this error.
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
I have a few ideas why that is happening, and while writing this i just got another one.
The wcf service somehow threw away the reference to the event class. That would be very weird since i have a reference between my main mvc app (with the models) and my WCF service.
Since i have enabled lazy loading in EF 4.0, i suspect that it may be the thing generating the error. But i'm not sure why that would be, because i'm not in any way accessing that field. I could understand that i may not be able to access the events field after i recive the object in my silverlight application since the connection between the book object and the entity framework is like broken.
Did i mention that Lazy Loading is enabled on my EF instance? And there is no inner exception in the thrown exception.
Thanks in advance. Malte Baden Hansen
© Stack Overflow or respective owner