2013-03-20 59 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