必须要转化成字符串返回才行-XmlWebService

System.InvalidOperationException: 生成 XML 文档时出错。 
         ---> System.InvalidOperationException: 必须在 System.Collections.Generic.Queue`1
          [[LibCore.Models+M_Keyword, LibCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] 

         上实现默认访问器,因为它继承自 ICollection。

在 System.Xml.Serialization.TypeScope.GetDefaultIndexer(Type type, String memberInfo)
           在 System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, MemberInfo memberInfo, Boolean directReference)
           在 System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
           在 System.Xml.Serialization.XmlSerializationWriter.CreateUnknownTypeException(Type type)
           在 System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
           在 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
           在 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write3_anyType(Object o)
           在 Microsoft.Xml.Serialization.GeneratedAssembly.ObjectSerializer.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
           在 System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
           --- 内部异常堆栈跟踪的结尾 ---
           在 System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
           在 System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
           在 System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
           在 System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
           在 System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
           在 System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
           在 System.Web.Services.Protocols.WebServiceHandler.Invoke(


ASP.NET Web服务应用程序

因为不能直接返回.net framework支持的集合。而必须要转化成字符串返回才行!

20150204 伦备秀邦


你可能感兴趣的:(必须要转化成字符串返回才行-XmlWebService)