.NET Web服务无法生成临时类 [英] .NET Web service unable to generate a temporary class

查看:113
本文介绍了.NET Web服务无法生成临时类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在.NET Web应用程序中实例化Web服务。但是只要它到达以下行:

I'm trying to instantiate a web service in my .NET web application. But as soon as it hits this line:

registerService register = new registerService();

然后我得到以下错误:


无法生成临时类(结果= 1)。错误CS0030:无法
将类型'Test.Website.ProxyTest.registerType []'转换为
'Test.Website.ProxyTest.registerType'

Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'Test.Website.ProxyTest.registerType[]' to 'Test.Website.ProxyTest.registerType'

我没有编写Web服务。但这是否意味着该Web服务在某处(在XSD或某些地方)有错误?

I didn't write the web service. But does this mean the web service has an error somewhere (in an XSD or something)?

这是否意味着第三方开发人员需要修复此Web服务?

Does this mean that the 3rd party developers need to fix this web service?

推荐答案

这似乎是一个已知问题,详细信息可以为在此处找到

It seems to be a Known issue and the details can be found here


原因: .NET Framework中包含的WSDL.EXE的已知问题可能会导致
如果复杂
类型的数组包含的元素也是$ b $的复杂类型数组,则
会导致代理类生成不正确b仅存在一个元素

Cause: A known issue with WSDL.EXE included in the .NET Framework can cause a proxy class to be generated incorrectly if an array of complex type includes an element that is also an array of complex type for which only one element exists


目前没有可用的解决方案,但是有三种
可用的解决方法:

There is no resolution available at this time however there are three available workarounds:

使用WSDL.EXE手动生成代理类,然后修改
代理类,其中数据类型不正确优先创建为
二维数组(例如 CustomType [] []),并将其更正为
一维数组(例如 CustomType [])。修改所需的WSDL中
中的数据类型,以便在
定义中包含第二个可选元素。这可以通过添加诸如
’之类的元素来完成。在所需的WSDL中修改复杂类型,使
的边界属性成为复杂类型的一部分,而不是元素的
(即,将 minOccurs和 maxOccurs属性移至
复杂对象中)并将其从元素中删除。)

Generate the proxy class manually using WSDL.EXE and then modify the proxy class where the datatype has been inappropriately created as a two-dimensional array (e.g. 'CustomType[][]') and correct it to be a single-dimensional array (e.g. 'CustomType[]'). Modify the datatype in the desired WSDL so that a second, optional element is included in the definition. This can be done by adding an element such as ''. Modify the complex type in the desired WSDL so that the boundary attributes are part of the complex type rather than the element (i.e. move the "minOccurs" and "maxOccurs" attributes to the complex type and remove them from the element).

类似的堆栈溢出问题

这篇关于.NET Web服务无法生成临时类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆