에 기인하지 않는 멤버를 직렬화하려고합니다.WCF는 다음 DataContract 감안할 [DataMember를]
System.NotSupportedException: Cannot serialize member GetGameSessionHistory.GameSessionsValue of type System.Collections.Generic.IEnumerable`1[[GameSession, Common, Version=3.45.0.11, Culture=neutral, PublicKeyToken=null]] because it is an interface.
은 또한 전체 [DataContract] 특성을 제거하는 구체적 [IgnoreDataMember]으로 영향 부재를 무시의 접근을 시도했다. 그러나 불행히도 그 결과는 똑같습니다.
업데이트 1
주어진 코드의 람다 표현식 내가 할 계획 단지 단계이었다. 문제는 다음 DataContract를 사용할 때 동일하게 유지됩니다.
[DataContract]
public class GetGameSessionHistory : ValueBaseCasinoIT
{
[DataMember]
public GameSession[] GameSessions { get; set; }
public IEnumerable<GameSession> GameSessionsValue { get; set; }
}
IEnumerable을 제거하면 메시지가 사라집니다. 문제는 GameSession 유형에서 가져올 수 없습니다.
현재 XmlSerializer을 사용하고 있습니다.
데이터는 다음과 같은 서비스에 사용됩니다
IAdapterService :
[ServiceContract, XmlSerializerFormat(Style = OperationFormatStyle.Rpc, Use = OperationFormatUse.Encoded), DispatchByBodyBehavior]
public interface IAdapterService
{
[OperationContract(Name = "GetGameSessionHistoryRequest", Action = ""), DispatchBodyElement("GetGameSessionHistoryRequest", "...")]
GetGameSessionHistory GetGameSessionHistory(AuthenticationToken authenticationToken, string playerId, DateTime fromDate, DateTime toDate);
}
AdapterService :
[SoapDocumentService(SoapBindingUse.Literal, RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
public class AdapterService : IAdapterService
{
public GetGameSessionHistory GetGameSessionHistory(AuthenticationToken authenticationToken, string playerId, DateTime fromDate, DateTime toDate)
{ ... }
}
의 Web.config :
<basicHttpBinding>
<binding name="SoapBinding">
<security mode="None"/>
<readerQuotas maxDepth="4000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="32768"/>
</binding>
</basicHttpBinding>
<service name="...svc.AdapterService" behaviorConfiguration="svcBehavior" >
<endpoint binding="basicHttpBinding" bindingConfiguration="SoapBinding" contract="...IAdapterService" name="AdapterSoapBinding" behaviorConfiguration="withMessageInspector"/>
</service>
다른 무엇을 할 수 캘리포니아 이 문제를 사용합니까?
음, 다른 것들은 제외하고 *'GameSessions'를 역 직렬화 할 수 없습니다 –
관련 항목 : http://stackoverflow.com/questions/2068897/cannot-serialize-parameter-of-type-system- linq-enumerable-when-using-wcf –
** 어떤 serializer WCF가 사용되도록 구성되었는지 ** 정확하게 확인할 수 있습니까? 구성에 의해 선택 될 수있는'DataContractSerializer'와'NetDataContractSerializer'가 있습니다. (편집 : 내 대답에있는 코드에서'NetDataContractSerializer'를 시도했지만 여전히 정상적으로 작동했습니다.) –