我有一个 Web 服务,当我尝试生成它的对象时,出现以下错误。
“无法生成临时类(结果 = 1)。错误 CS0030:无法将类型“ShortSell.ShortSellRQOriginDestinationInformationFlightSegment[]”转换为“ShortSell.ShortSellRQOriginDestinationInformationFlightSegment”错误 CS0030:无法转换类型“ShortSell.ShortSellRSOriginDestinationOptionFlightSegment[] ' 到 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment '错误CS0030:无法将类型'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment []'转换为'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'错误CS0029:无法将类型'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'隐式转换为'ShortSell。 ShortSellRQOriginDestinationInformationFlightSegment[]'错误CS0029:无法隐式转换类型'ShortSell。 ShortSellRSOriginDestinationOptionFlightSegment' 到 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment[]' 错误 CS0029:无法将类型 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment' 隐式转换为 'ShortSell.ShortSell.ShortSellRSOriginDestinationOptionFlightSegment[]'"}
我尝试将临时文件夹属性更改为可写,但仍然收到此错误。为什么我会收到此错误以及如何修复它?
这是一个不会修复的已知错误:
- 微软连接:当只有一个元素时,XmlSerializer 代码生成组件无法处理嵌套的无界元素 https://web.archive.org/web/20120621134819/http://connect.microsoft.com/VisualStudio/feedback/details/471297
当 wsdl 中的复杂类型恰好包含一个无限出现的元素时,就会发生此错误。解决方法,取自本次论坛讨论 http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e33305c3-b5f6-4922-8a3f-df202088d25a(归功于 Elena Kharitidi),就是为此类类型添加虚拟属性:
<xs:sequence maxOccurs="unbounded">
<xs:element ../>
<xs:sequence>
<xs:attribute name="tmp" type="xs:string" /> <-- add this
and
<xs:sequence>
<xs:element maxOccurs="unbounded"/>
<xs:sequence>
<xs:attribute name="tmp" type="xs:string" /> <-- add this
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)