I have created a WCF service which returns IEnumerable<CyberResourceProvisioningAction>
.
The CyberResourceProvisioningAction type has a property of AccountInformation IEnumerable<CyberResourceProvisioningActionAccountInfo>
. When I decorate the AccountInformation property with DataMemberAttribute I receive the exception:
WCF System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly
Obviously a very generic exception, but my Google-fu indicates that the issue most commonly occurs when returning large numbers of objects in a collection. The suggested fix is to set the <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
. Unfortunately this has not fixed my issue. (Didn't think it would as I am returning a small amount of data).
The properties are being set correctly so I am pretty sure my issue has to do with my serialization configuration. Is there something wrong with my classes which is causing the WCF service to error in this way?
[DataContract]
public class CyberResourceProvisioningAction
{
[DataMember]
public string Action { get; set; }
[DataMember]
public DateTime RcdChgDateTime { get; set; }
[DataMember]
public string CyberResourceName { get; set; }
[DataMember]
public IEnumerable<CyberResourceProvisioningActionAccountInfo> AccountInformation
{ get; set; }
}
CyberResourceProvisioningActionAccountInfo
[DataContract]
public class CyberResourceProvisioningActionAccountInfo
{
[DataMember]
public string Name { get; set; }
[DataMember]
public string Value { get; set; }
}
If additional configuration information is required let me know and I'll edit the post.
WcfTestClient
– Talie