2009-09-30 34 views
0

我已經通過創建一個快速.net 3.5項目進行測試的同事提供了Web服務。該服務公開了一個返回DataTable的簡單方法,並且一切正常。(不是Web服務平臺獨立?)Web服務在.net 2.0+項目中工作,但不是.net 1.1

生產項目.NET 1.1,雖然,我得到創建Web服務對象上線運行時錯誤:


 
The XML element '' from namespace 'web/InternetData' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: The XML element '' from namespace 'web/InternetData' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 
[InvalidOperationException: The XML element '' from namespace 'http://web/InternetData' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.] 
    System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(INameScope scope, Accessor accessor) +866695 
    System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(MemberMapping member, INameScope elements, INameScope attributes, Boolean isSequence) +84 
    System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) +1553 

[InvalidOperationException: There was an error reflecting 'AccountNumberResult'.] 
    System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +843 
    System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access) +130 
    System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate, Boolean openModel, String key, Boolean writeAccess) +223 
    System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +2989 

[InvalidOperationException: Method Service.CashieringSupport_By_AccountNumber can not be reflected.] 

我首先想到的是創建一個單獨的2.0項目轉儲數據以供1.1項目重新使用,但這似乎是不必要的一步。

回答

1

Web服務意味着與平臺無關 - 除非你做一些事情使它們依賴於平臺。就像返回依賴於平臺的數據一樣。有點像DataTable

+0

這是一個很好的觀點。返回類型似乎是我的1.1應用程序無法解析的。我最終在2.0中編寫了一個數據轉儲,然後被1.1應用程序吞併。不理想,但它的工作原理。 – John 2009-11-04 17:38:31