WCF - MessageBodyMember - Stream - "Value cannot be null"

I have a MessageContract containing one instance of BodyMember. When I try to send this message contract without initializing this BodyMember, I get the following exceptions:

An error occurred System.ArgumentNullException Message = Value cannot be null. Parameter Name: FileStream

If I change it to MessageHeader, it will work (but I need it to remain BodyMember). Is it possible that MessageBodyMember cannot be null or that the thread cannot be null?

This is MessageContract:

[MessageContract]
public class AdsAdminRequest : ServiceMessageRequest
{
    [MessageHeader]
    public AdsAdminCriteria Criteria { get; set; }

    [MessageHeader]
    public AdDto Ad { get; set; }

    [MessageBodyMember]
    public Stream FileStream { get; set; }
}
+5
source share
1 answer

- , " ". null ( Nothing), Stream.Null.

+11

All Articles