WCF消息合同版本控制

编程入门 行业动态 更新时间:2024-10-25 10:25:25
本文介绍了WCF消息合同版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我创建了一个WCF服务,并使用消息合同将数据传递给客户端。 我在消息合同中添加了一个新成员,但我没有更新客户端的服务引用。 现在根据WCF版本控制旧客户端应该可以工作,但在我的情况下,当我获得服务调用后的数据时,一些成员被填充,一些成员为空(新旧邮件合同之间通用的成员。) 我也使用transport ='Streamed'进行服务绑定。 我想知道我是否遗漏了什么。 我遇到了与数据合同相同的问题。 提前谢谢。

Hi, I had created a WCF service and used message contract to pass data to client. I added a new member in message contract and I did not update the service reference of the client. Now as per WCF versioning the old client should work,but In my case when I get the data after service call,some of the members are populated and some are null(members that are common between the old and new message contract). I am also using transport='Streamed' for the service binding. I would like to know whether I am missing something. I faced the same issue with data contracts. Thanks in advance.

推荐答案

我的问题通过为新添加的成员添加值为2的DataMember属性的'Order'成员来解决 My problem is solved by adding 'Order' member of DataMember attribute with value =2 for newly added members

更多推荐

WCF消息合同版本控制

本文发布于:2023-11-07 17:29:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567025.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:合同   消息   版本   WCF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!