How To Force WCF Service To Use XmlSerializer Instead Of The DataContractSerializer


Have you ever wanted to return Attributes, or have further control over serialization when using WCF?  By default, it uses the DataContractSerializer, but you can tell it to use the XmlSerializer.  



1.  Ensure you have your interface marked with [ServiceContract]

2.  Add XmlSerializerFormat to your method



 [WebGet(UriTemplate = "employee")]



 Response GetEmployees();


Now your WCF call will use the XmlSerializer rather than the DataContractSerializer.


There are no notes on this topic.