WCF:为什么我无法将对象列表发送到我的Web服务 [英] WCF : Why I can't send a List of objects to my webservice
问题描述
我建立了一个对象列表: List< Mandat>
I build a List of objects : List<Mandat>
我像这样称呼我的网络服务:
And I call my webservice Like these :
ServiceGestionClient svc = new ServiceGestionClient();
svc.setNewMandatImage(listMandat);
在我的Web服务中,我有这些:
In my Webservice I have these :
public void setNewMandatImage(List<Mandat> mi)
但是我有这些错误:
Unable to convert from list<Mandat> to mandat[]
他为什么要尝试将其转换为数组?
Why does he try to convert as an array ?
推荐答案
原因是WCF将通用列表序列化为一个数组,以便通过网络发送.该配置只是告诉svcutil创建代理,为了方便起见将它们转换回通用列表.
The reason is that WCF serializes the universal list into an array to send over the network. The configuration just tells svcutil to create a proxy and convert them back to a common list for convenience.
解决方案:
在添加服务参考"工具中设置:
Set in the Add Service Reference tool:
最后,应用此设置以生成代理类.
Finally, apply this setting to generate a proxy class.
如果问题仍然存在,请随时告诉我.
Feel free to let me know if the problem persists.
这篇关于WCF:为什么我无法将对象列表发送到我的Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!