我有一个Web服务,当我尝试生成它的对象时,我遇到了错误。
“无法生成临时类(result = 1).error CS0030:无法将类型'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment []'转换为'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'error CS0030:无法将类型'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment []'转换为' ShortSell.ShortSellRSOriginDestinationOptionFlightSegment'error CS0030:无法将类型“ShortSell.ShortSellRQOriginDestinationInformationFlightSegment []”到“ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'error CS0029:无法隐式转换类型‘ShortSell.ShortSellRQOriginDestinationInformationFlightSegment’到‘ShortSell.ShortSellRQOriginDestinationInformationFlightSegment []’错误CS0029:无法隐式转换类型'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment'到'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment []'错误CS0029:无法隐式转换类型'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment't o'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment []'“}
我尝试将临时文件夹属性更改为可写但我仍然收到此错误。为什么我会收到此错误以及如何解决?
答案 0 :(得分:23)
这是一个无法修复的已知错误:
当wsdl中的复杂类型恰好包含一个具有无限发生的元素时,会发生错误。从this forum discussion(信用到Elena Kharitidi)获取的解决方法是为这些类型添加虚拟属性:
<xs:sequence maxOccurs="unbounded">
<xs:element ../>
<xs:sequence>
<xs:attribute name="tmp" type="xs:string" /> <-- add this
和
<xs:sequence>
<xs:element maxOccurs="unbounded"/>
<xs:sequence>
<xs:attribute name="tmp" type="xs:string" /> <-- add this