C#调用某远程webservice接口上传数据,在win10系统中正常,在winXP中报错,提示信息如下:

16:56:15 The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:QuerySalesItemResponse. The InnerException message was 'There was an error deserializing the object of type VictUpload.ServiceEtMobile2.QuerySalesItemResponseBody. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 29310.'.  Please see InnerException for more details.

找出重点:This quota may be increased by changing the MaxStringContentLength property

网上搜索一番,找到了答案:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/da9b5252-de00-498d-b6b7-d256de47b8c6/the-maximum-string-content-length-quota-8192-has-been-exceeded-while-reading-xml-data-?forum=wcf

修改方法:在binding节点内增加设置readerQuotas节点:

<binding name="instrumentDockingServiceProviderServiceBinding" >
	<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
		maxArrayLength="2147483647" maxBytesPerRead="2147483647"
		maxNameTableCharCount="2147483647" />
</binding>

问题解决。