c# - .NET Web 服务无法生成临时类

标签 c# .net web-services wsdl

我正在尝试在我的 .NET 网络应用程序中实例化网络服务。但是一旦它碰到这条线:

registerService register = new registerService();

然后我得到以下错误:

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

我没有编写网络服务。但这是否意味着 Web 服务在某个地方(在 XSD 或其他地方)有错误?

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

最佳答案

这似乎是一个已知问题,详细信息可以是found here

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:

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).

类似stackoverflow question

关于c# - .NET Web 服务无法生成临时类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15522589/

相关文章:

c# - EF 一对一关系改变实体与另一个实体(替代)

Java接口(interface)和实现

ios - 在 ios 中异步调用 Web 服务

c# - 以编程方式从后面的代码关闭 aspx 页面

c# - 多个运行时过滤器的动态 Linq 查询

c# - 使用 LINQ 优化二维数组的搜索

c# - 如何使用系统菜单创建无边框表单?

c# - Json字符串反序列化为对象数组列表

.net - 为什么 ObjectStateFormatter 类在 System.Web.UI 命名空间中?

spring - 如何减少使用多层架构实现的服务中的冗余,同时保持整个系统的一致性?