标签:
.Net 4.5.1
Visual Studio 2015RC
Windows 8.1
SQL Server 2005 sp1
.Net 4.0 en
Windows Server 2003
SQL Server 2005 sp1
WCF客户端,开发环境测试正常。发布到运行环境后,提示Type ‘System.Threading.Tasks.Task`1[XMRBI.ERoad.Contracts.ServiceResponse]‘ 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.
Visual Studio 2012以上版本的svcutil默认情况下会生成XXXAsync的调用方法。类似System.Threading.Tasks.Task<T>
。但是在运行环境,.Net4.0不支持Task<T>
。
关闭生成异步方法
svcutil /syncOnly
手动删除生成结果的XXXAsync方法
标签:
原文地址:http://www.cnblogs.com/boywujch/p/1a92652ed40f8a6182339e6469b72028.html