Reputation: 11
I'm getting below error when I try to transfer more than 150MB files.
System.ServiceModel.CommunicationException was unhandled
Message="An error occurred while making the HTTP request to http://localhost:2122/Service1.svc. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.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 Cleint.ServiceReference1.IService1.UploadFile(RemoteFileInfo request)
at Cleint.ServiceReference1.Service1Client.Cleint.ServiceReference1.IService1.UploadFile(RemoteFileInfo request) in D:\MCT_Work\Sample Projects\WCFFileTransferTest\Cleint\Service References\ServiceReference1\Reference.cs:line 81
at Cleint.ServiceReference1.Service1Client.UploadFile(String fileName, Stream fileByteStream) in D:\MCT_Work\Sample Projects\WCFFileTransferTest\Cleint\Service References\ServiceReference1\Reference.cs:line 88
at Cleint.Program.Main(String[] args) in D:\MCT_Work\Sample Projects\WCFFileTransferTest\Cleint\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Net.WebException
Message="The underlying connection was closed: An unexpected error occurred on a send."
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
InnerException: System.IO.IOException
Message="Unable to write data to the transport connection: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full."
Source="System"
StackTrace:
at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
at System.Net.Connection.Write(ScatterGatherBuffers writeBuffer)
at System.Net.ConnectStream.ResubmitWrite(ConnectStream oldStream, Boolean suppressWrite)
InnerException: System.Net.Sockets.SocketException
Message="An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full"
Source="System"
ErrorCode=10055
NativeErrorCode=10055
StackTrace:
at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
InnerException:
Upvotes: 1
Views: 1125
Reputation: 2113
By default, the transferMode
is buffer, so the large messages are bufferred in memory. If you've access to change Service destination (code), I'd suggest to use transfer mode Streaming or MTOM message encoding to exchange such a large messages/files.
Upvotes: 1
Reputation: 31750
Why are you trying to transmit 150MB across a web service boundary? This design will almost certainly cause you availability issues on the service endpoint.
A better design would be to write the file to disk somewhere, and then send a command message to the service to pick up the file.
Upvotes: 0