wcf的svcutil.exe工具生成代码的奇怪问题

原本是用wcf的svcutil.exe生成客户端的代码,然后在本地调试、单元测试、功能集成都一切ok,但是一旦放倒win2008的服务器上就发生了很奇怪的问题,爆出如下的异常:

Type 'System.Threading.Tasks.Task`1[BitAuto.MaiChe.ESB.UserService.ActionResultsOfUserAccessTokenEntityr_PAdGrmY]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  If the type is a collection, consider marking it with the CollectionDataContractAttribute.  See the Microsoft .NET Framework documentation for other supported types.

但是对应的类命名是有相应的属性标签的。

后来基于工程管理的考虑,把对应的类的名字改了,然后把引用方式改成了直接服务引用,奇怪的事情发生了,上面的错误没有了。

然后把引用生成的客户端代码和svcutil.exe生成客户端的代码放在一起对比了一下,代码是不一样的,问题在此?svcutil.exe生成代码会在win2008上有问题?

最近时间比较近,暂时mark,留待忙完这段时间详细研究

有碰到过相同问题的同学请赐教啊

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/AI001/p/4614357.html