2013-03-20 60 views
4

我想在我的.NET Web应用程序中实例化一个Web服务。但只要它击中这一行:.NET Web服务无法生成临时类

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服务。但是这是否意味着Web服务在某处出现了错误(在XSD或其他内容中)?

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

+0

也许这可能帮助http://stackoverflow.com/questions/6678934/unable-to-generate-a-temporary-class-result-1-error-cs0030-cannot -convert-ty – V4Vendetta 2013-03-20 11:48:37

+0

@ V4Vendetta谢谢,这确实有帮助。但是我仍然想知道这是否最终应该由创建Web服务的人来解决。任何想法呢? – Vivendi 2013-03-20 12:20:04

+0

我想这是一个已知问题http://support.microsoft.com/kb/2486643,所以也许解决方法可以帮助 – V4Vendetta 2013-03-20 12:23:44

回答

8

这似乎是一个已知的问题和细节可以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