Complex data types in WCF?
Posted
by Hojou
on Stack Overflow
See other posts from Stack Overflow
or by Hojou
Published on 2008-10-15T08:31:14Z
Indexed on
2010/03/19
3:01 UTC
Read the original article
Hit count: 551
wcf
|complex-data-types
I've run into a problem trying to return an object that holds a collection of childobjects that again can hold a collection of grandchild objects. I get an error, 'connection forcibly closed by host'.
Is there any way to make this work? I currently have a structure resembling this:
pseudo code:
Person:
IEnumerable<Order>
Order:
IEnumberable<OrderLine>
All three objects have the DataContract attribute and all public properties i want exposed (including the IEnumerable's) have the DataMember attribute.
I have multiple OperationContract's on my service and all the methods returning a single object OR an IEnumerable of an object works perfectly. It's only when i try to nest IEnumerable that it turns bad. Also in my client service reference i picked the generic list as my collection type. I just want to emphasize, only one of my operations/methods fail with this error - the rest of them work perfectly.
EDIT (more detailed error description):
[SocketException (0x2746): An existing connection was forcibly closed by
the remote host]
[IOException: Unable to read data from the transport connection:
An existing connection was forcibly closed by the remote host.]
[WebException: The underlying connection was closed: An unexpected
error occurred on a receive.]
[CommunicationException: An error occurred while receiving the HTTP
response to http://myservice.mydomain.dk/MyService.svc. This could
be due to the service endpoint binding not using the HTTP protocol.
This could also be due to an HTTP request context being aborted by
the server (possibly due to the service shutting down). See server
logs for more details.]
I tried looking for logs but i can't find any... also i'm using a WSHttpBinding and an http endpoint.
© Stack Overflow or respective owner