简体   繁体   English

为什么我的WebService调用仅对一个用户失败?

[英]Why does my WebService call fail only for one user?

I have a simple WebService method that returns database results as a DataSet. 我有一个简单的WebService方法,该方法将数据库结果作为DataSet返回。

This method fails for one user in the company but works for everyone else Here is the crash: 对于公司中的一个用户,此方法失败,但对其他所有用户都有效,这是崩溃:

    CRASH! GetCustomer - 
ExtractDomesticCommercialState: Exception:InvalidOperationException 
Message:There is an error in XML document (1, 877). 
Source:     System.Xml TargetSite: Deserialize StackTrace:    
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)     
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)     
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)     
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)     
at Cwc.Common.basis2_ws.Basis2WebService.GetRetailChargeGroupByInstId(String instId)     
at Cwc.Common.Basis2ServiceLayer.GetRetailChargeGroupByInstId(String instId)     
at Cwc.WaterWorks.Console.frmMain.GetCustomer(String customerKey, Boolean afterCreate)

Exception:FormatException Message:Input string was not in a correct format. 
Source:     mscorlib TargetSite: StringToNumber 
StackTrace:    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)     
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)     
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)     
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)     
at System.Data.XSDSchema.HandleElementColumn(XmlSchemaElement elem, DataTable table, Boolean isBase)     
at System.Data.XSDSchema.HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList tableChildren, Boolean isBase)     
at System.Data.XSDSchema.HandleComplexType(XmlSchemaComplexType ct, DataTable table, ArrayList tableChildren, Boolean isNillable)     
at System.Data.XSDSchema.InstantiateTable(XmlSchemaElement node, XmlSchemaComplexType typeNode, Boolean isRef)     
at System.Data.XSDSchema.HandleTable(XmlSchemaElement node)     
at System.Data.XSDSchema.HandleDataSet(XmlSchemaElement node, Boolean isNewDataSet)     
at System.Data.XSDSchema.LoadSchema(XmlSchemaSet schemaSet, DataSet ds)     
at System.Data.DataSet.ReadXSDSchema(XmlReader reader, Boolean denyResolving)     
at System.Data.DataSet.ReadXml(XmlReader reader, XmlReadMode mode, Boolean denyResolving)     
at System.Data.DataSet.ReadXmlSerializable(XmlReader reader)     
at System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader reader)     
at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable, Boolean wrappedAny)     
at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable)     
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderBasis2WebService.Read18_Item()     
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer25.Deserialize(XmlSerializationReader reader)     
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) 

The client is a .Net WinForms application I have verified the method in the Webservice is generating XML correctly Just seems the deserialisation fails 客户端是.Net WinForms应用程序,我已经验证了Web服务中的方法正确生成了XML似乎反序列化失败

Could it be because she is running .Net Framework 4 and the application was built for 3.5? 可能是因为她正在运行.Net Framework 4并且该应用程序是为3.5构建的吗?

Exception:FormatException Message:Input string was not in a correct format

Is the culture on the user's machine the same as the others which are working? 用户计算机上的文化与其他计算机上的文化是否相同? Just an idea as it may be using a different culture therefore using a different IFormatProvider 只是一个想法,因为它可能使用了不同的文化,因此使用了不同的IFormatProvider

look at the middle of your stack trace... 看一下堆栈跟踪的中间...

at Cwc.WaterWorks.Console.frmMain.GetCustomer(String customerKey, Boolean afterCreate)

Exception:FormatException Message:Input string was not in a correct format. 
Source:     mscorlib TargetSite: StringToNumber 
StackTrace:    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)     
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) 

Seems like a parsing error from String to Int .... I suggest you try and investigate this area. 好像是从String到Int ...的解析错误。建议您尝试研究此区域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM