2017-04-12 318 views
0

928mb文件可以正常工作,但是当我尝试向soap服务发送1.08GB时发生此溢出错误(mtom chunked transfer,_service reference.cs从wsdl生成)。在提琴手跟踪我看到的只是请求的头,但没有要求的身体也没有反应C#soap客户端System.OverflowException:算术运算导致溢出

相关代码:

var httpsTransportBindingElement = new HttpsTransportBindingElement 
{ 
    MaxReceivedMessageSize = int.MaxValue, 
    TransferMode = TransferMode.Streamed //Chunked transfer 
}; 
var binding = new CustomBinding(); 
var mtomEncoding = new MtomMessageEncodingBindingElement(MessageVersion.Soap12, Encoding.UTF8); 
mtomEncoding.ReaderQuotas.MaxStringContentLength = int.MaxValue; 
binding.Elements.Add(mtomEncoding); 
binding.Elements.Add(httpsTransportBindingElement); 
binding.SendTimeout = TimeSpan.FromHours(1); 
binding.ReceiveTimeout = TimeSpan.FromMinutes(5); 
_service = new FileuploadSoapPortTypeClient(binding, new EndpointAddress(configuration.HttpUploadUrl)); 
_service.PostFile(request); 

和错误堆栈跟踪如下:

System.OverflowException: Arithmetic operation resulted in an overflow. 

Server stack trace: 
at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count) 
at System.Xml.XmlMtomWriter.WriteXOPBinaryParts() 
at System.ServiceModel.Channels.Message.WriteMessagePostamble(XmlDictionaryWriter writer) 
at System.ServiceModel.Channels.MtomMessageEncoder.WriteMessage(Message message, Stream stream, String startInfo, String boundary, String startUri, Boolean writeMessageHeaders) 
at System.ServiceModel.Channels.HttpOutput.WriteStreamedMessage(TimeSpan timeout) 
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout) 
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout) 
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) 
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) 
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
at MyServiceClient.FileuploadSoapPortType.PostFile(UploadRequest request) 
at MyServiceClient.FileuploadSoapPortType.PostFile(UploadRequest request) in C:\MyServiceClient\Reference.cs:line 8473 

我不能除PostFile()调用外,进一步调试,所以我的问题是 - 错误发生在服务器还是我的客户端?当然如何去解决它?谢谢!

+0

'服务器堆栈跟踪:'问题是在服务器 –

+0

谢谢,这将是一个答案,如果你也能告诉我如何去解释它的地方出现错误的服务提供商?通常我会收到肥皂故障信息,我可以将它们发送给他们进行审查,但在这种情况下没有回应 – Succenna

+0

这里发生了什么? C:\ MyServiceClient \ Reference.cs:line 8473 –

回答

0

从堆栈跟踪它告诉你,这是服务器端:

Server stack trace: 

错误是由什么引起的,其在发生:

at MyServiceClient.FileuploadSoapPortType.PostFile(UploadRequest request) in C:\MyServiceClient\Reference.cs:line 8473 

访问该文件,看看有什么正在发生这一行。我想想想,当发生这样的事情时,他们已经记录了Web服务的托管位置。

要找出原因,我建议:

  • 给它发生的时间(如果他们有记录其更容易找到堆栈跟踪)的你试图做什么错误发生时
  • 详细说明。
相关问题