can i use a generic list in a WCF called from silverlight?

折月煮酒 提交于 2020-01-17 03:26:19

问题


when i return a generic List of my custom object in a wcf service, silverlight gives me this error when i update my service reference (and the reference.cs file is completely blank)

ugly ones like this:

Warning 18  Custom tool warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='']/wsdl:portType[@name='Service1']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='CustomBinding_Service1']  C:\Silverlight\POCFinRap\FinRapSilverlightPoc\FinRapSilverlightPoc\Service References\ServiceReference2\Reference.svcmap    1   1   FinRapSilverlightPoc

When i change the return type to a string, all goes fine. (also when i return a List<string> it gives me the errors)

edit 1: by the way: it's SL4 edit 2: i have a silverlight project and a webproject (default created by vs2010) and the SVC is in the webproject.


回答1:


After a LOT of trial and error and a post which i clicked away accidentily so i can't give him/her credits:

The 'reuse types in referenced assemblies' checkbox gave me the troubles.



来源:https://stackoverflow.com/questions/2865998/can-i-use-a-generic-list-in-a-wcf-called-from-silverlight

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!