开发者

NetDataContractSerialization throwing deserialization error

I have methods which return interface and some methods which accepts interface as parameters. I am trying to use Net DataContractSerializer but I am getting following error...

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:id. The InnerException message was 'Error in line 1 position 120. XML 'Element' 'http://tempuri.org/:id' does 开发者_运维百科not contain expected attribute 'http://schemas.microsoft.com/2003/10/Serialization/:Type'. The deserializer has no knowledge of which type to deserialize. Check that the type being serialized has the same contract as the type being deserialized.'. Please see InnerException for more details.

Please help me how to resolve this error....

If I use Netdatacontract attribute on Operation Contract, can i use DataContract and Datamember attribute on serializable class???

Thanks in advance...


Just guessing - the error seems to indicate the NetDataContractSerializer can't properly determine what type to deserialize your content into.

Could it be that you're not specifying the http://tempuri.org XML namespace to the deserializer??

Also, can you show the content of the InnerException, please?

Or second option: using the NetDataContractSerializer, you need to also share the data contracts between server and client, so that the client can deserialize to the exact same type as was defined on the server side. Are you missing this requirement, maybe??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜