I have a requirement in which i have to use System.Object as a parameter in WCF. As it is not serializable,I am getting the message as the operation is not supported as it uses System.Object. Any solution to this problem.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When sending messages over the wire, WCF by default will only serialize what’s enough to get the message across, i.e., the members of the contracts. If your message takes an “object” as a parameter, extra information needs to be sent over the wire with the type information. If you use the same assemblies on the client and the server, you can use the NetDataContractSerializer (instead of the default DataContractSerializer) in the server (and the client), and they’ll be able to exchange arbitrary objects, as shown in the code below. But, as @MarcGravell mentioned, this may not be the best usage of WCF…
The code to enable the
NetDataContractSerializer: