WCF MessageBodyMember required

I am new to WCF and have a basic question about an attribute [MessageBodyMember]

.

As far as I understand, in the case of the attribute [DataMember]

, if you don't set IsRequired = true, there will be no problem getting and deserializing the message.

What happens if you send a message that is missing MessageBodyMember

s? (For example, from an earlier version of the interface)

+3


source to share


1 answer


If you don't MessageBodyMemberAttribute

have where you explicitly define the contract with MessageContractAttribute

, the message will still be processed with maximum efficiency.

From the MSDN documentation Using Contracts with Messages (under Message Versioning, main focus):



Message bodies have similar versioning rules - both are missing and additional body parts of the message are ignored.

Of course, if your contract (or implementation) is not built to handle the missing body part, then that's a separate issue altogether.

+1


source







All Articles