Add Service Reference is ALWAYS generating xmlseri

2019-07-15 13:35发布

问题:

i have a service : http://chronicpainhostservice2.cloudapp.net/Service1.svc i consume it in silverlight 5.0 application. and it all worked fine. However, when i adding this service to the project using "add service reference" it ALWAYS generating xmlserializer

One more thing - when i try to add it to simple windows application it is generating DataContractSerializer , so the problem is not in the server.

How can i force silverlight to generate DataContractSerializer ? Thanks!

回答1:

It looks like svcutil try to verify some conditions before using the appropriate Serializer. here are some details : http://kjellsj.blogspot.com/2008/03/wcf-datacontractserializer-schema-rules.html

have you tried to force the serializer used by calling manually svcutil : svcutil http://chronicpainhostservice2.cloudapp.net/Service1.svc /ser:DataContractSerializer