我正在从vb .net客户端使用java web服务。此服务返回一个对象(称为serviceResponse),该对象具有三个字段:一个整数和两个字节数组
Dim serviceResponse As MyWebService.serviceResponse = mVaultWebService.downloadData(inputBuffer)
当返回的数据量很小时,一切正常,但是当数据量很大时,我得到以下异常(在客户端)
Timeouts are not supported on this stream.
这是堆栈跟踪
StackTrace " Server stack trace: at System.IO.Stream.get_ReadTimeout()
at System.ServiceModel.Channels.HttpChannelUtilities.CreateResponseWebException(WebException webException, HttpWebResponse response)
at System.ServiceModel.Channels.HttpInput.WebResponseHttpInput.WebResponseInputStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.ServiceModel.Channels.MessageEncoder.BufferMessageStream(Stream stream, BufferManager bufferManager, Int32 maxBufferSize)
at System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, BufferManager bufferManager, Int32 maxBufferSize, String contentType)
at System.ServiceModel.Channels.HttpInput.ReadChunkedBufferedMessage(Stream inputStream)
at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(HttpRequestMessage httpRequestMessage, Exception& requestException)
at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 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 LeanCost.VaultWebService.LeanCostWS.downloadLeanCost(downloadLeanCostRequest request) at LeanCost.VaultWebService.LeanCostWSClient.VaultWebService_LeanCostWS_downloadLeanCost(downloadLeanCostRequest request) at LeanCost.VaultWebService.LeanCostWSClient.downloadLeanCost(Byte[] xml_input) at LeanCost.LcVaultWebService.CheckOut(Byte[] inputBuffer, Byte[]& xmlDocumentBuffer, Byte[]& zippedFilesBuffer, LcLog& log)" String
这是Web服务的配置方式
Dim binding As New BasicHttpBinding()
binding.MessageEncoding = WSMessageEncoding.Mtom
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic
binding.MaxReceivedMessageSize = Integer.MaxValue
binding.MaxBufferSize = Integer.MaxValue
binding.SendTimeout = New TimeSpan(0, 10, 0)
binding.ReceiveTimeout = New TimeSpan(0, 10, 0)
Dim address As New EndpointAddress(urlAddress)
mWebService = New MyWebService.WSClient(binding, address)
mWebService.ClientCredentials.UserName.UserName = username
mWebService.ClientCredentials.UserName.Password = password
我无法弄清楚导致此问题的原因,似乎绑定设置或某些配置属性未正确设置。 关于如何解决这个问题的任何想法?
提前致谢。