Note the pitfalls of the higher version of. Net in the WCF Development notes, and the wcf development. net
Development Environment of higher version. Net
. Net 4.5.1
Visual Studio 2015RC
Windows 8.1
Web SQL Server 2005 sp1
Running Environment
. Net 4.0 en
Windows Server 2003
Web SQL Server 2005 sp1
Symptom
The development environment test is normal on the WCF client. After publishing to the running environment, the System prompts "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.
Cause
By default, Visual Studio 2012 and later versions of svcutil generate the call method of XXXAsync. SimilarSystem. Threading. Tasks. Task <T>
. However, in the runtime environment,. Net4.0 does not supportTask <T>
.
Solution
Manually delete the XXXAsync method of the generated result
From Weizhi note (Wiz)