TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mark Conway
NA
10
16.5k
InvalidDataContractException occurs when returning Response Class that contains IEnumerable
Jun 7 2011 2:09 PM
Hi there,
I am encountering an exception when my WCF service attempts to create the data contract response class.
I thought that this problem might be have resulted from WCF not knowing how to Serialize IEnumberable, so I marked it as a known type. This did not work.
Any help on this would be quite welcome!!!
Details below.
Many thanks,
Mark
Service Contract:
[ServiceContract]
public interface IRefundService
{
[OperationContract]
RefundSearchCriteriaResponse FindRefunds(RefundSearchCriteriaRequest refundSearchCriteriaRequest);
}
Data Contract:
[DataContract]
[KnownType(typeof(List<Refund>))]
public class RefundSearchCriteriaResponse
{
[DataMember]
public IEnumerable<Refund> Refunds { get; set; }
[DataMember]
public int ItemCount { get; set; }
}
Exception Details:
Exception
:
InvalidDataContractException
Message
: Type 'System.Linq.OrderedEnumerable`2[Asos.Operations.Finance.ElectronicFunds.Entity.Refund,System.Nullable`1[System.Int64]]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. See the Microsoft .NET Framework documentation for other supported types.
Call stack:
System.Runtime.Serialization.dll!System.Runtime.Serialization.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(string message, System.Type type) + 0x12a bytes
------------------------------------------------------------------------------------------
System.Runtime.Serialization.dll!System.Runtime.Serialization.DataContract.DataContractCriticalHelper.CreateDataContract(int id, System.RuntimeTypeHandle typeHandle, System.Type type = {Name = "OrderedEnumerable`2" FullName = "System.Linq.OrderedEnumerable`2[[Asos.Operations.Finance.ElectronicFunds.Entity.Refund, Asos.Operations.Entity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}) + 0x20f bytes
------------------------------------------------------------------------------------------
System.Runtime.Serialization.dll!System.Runtime.Serialization.DataContract.DataContractCriticalHelper.GetDataContractSkipValidation(int id = 28, System.RuntimeTypeHandle typeHandle, System.Type type) + 0x4b bytes
Reply
Answers (
3
)
The request for security token could not be satisfied because authentication failed
please HELP... configure bin location for svc/wcf