As in title in what case svcutil.exe decides to apply XmlSerializerFormatAttribute in generated proxy code? I can't find any documentation about that so I'd be grateful for linking some sources.

有帮助吗?

解决方案

The XmlSerializer is chosen (and the XmlSerializerFormatAttribute is applied) whenever the schema of the web service is not compatible with DataContractSerializer. As user "Aphelion" pointed out in their answer, one case when this can happen is when using some legacy ASMX web services. However, it is also quite common to see this when interoperating with non-.NET services (for example, Java-based). The definitive document here is actually http://msdn.microsoft.com/en-us/library/ms733112.aspx , which tells you exactly what is and isn't supported in the schema.

其他提示

The XmlSerializerFormat is used to support backwards compatibility with ASMX (Classic web services).

By default, the proxy will use the DataContractSerializer. If the schema elements in the WSDL document use XSD schema features that the DataContractSerializer is unable to handle, it will pick the XmlSerializer.


I can recommend 'Learning WCF' by Michele Leroux Bustamante for some in-depth examples.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top