Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用带有basichttpbinding的WCF服务传输较大的文件_Wcf_Binding_Large Files_File Transfer - Fatal编程技术网

使用带有basichttpbinding的WCF服务传输较大的文件

使用带有basichttpbinding的WCF服务传输较大的文件,wcf,binding,large-files,file-transfer,Wcf,Binding,Large Files,File Transfer,当我尝试传输超过150MB的文件时,我遇到了以下错误 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 con

当我尝试传输超过150MB的文件时,我遇到了以下错误

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: 

为什么要尝试跨web服务边界传输150MB?这种设计几乎肯定会导致服务端点上的可用性问题


更好的设计是将文件写入磁盘的某个位置,然后向服务发送命令消息以获取文件

为什么要尝试跨web服务边界传输150MB?这种设计几乎肯定会导致服务端点上的可用性问题


更好的设计是将文件写入磁盘的某个位置,然后向服务发送命令消息以获取文件

默认情况下,
传输模式
缓冲区,因此大消息在内存中缓冲。如果您有权更改服务目的地(代码),我建议您使用传输模式MTOM消息编码来交换如此大的消息/文件

默认情况下,
传输模式
缓冲区,因此大消息在内存中缓冲。如果您有权更改服务目的地(代码),我建议您使用传输模式MTOM消息编码来交换如此大的消息/文件

对于较小的文件,它可以正常工作吗?能否显示绑定配置为web.config和app.config?存在一个内部错误,表示缓冲区空间不足。只需检查内存是否不足?对于较小的文件是否可以正常工作?能否显示绑定配置为web.config和app.config?存在一个内部错误,表示缓冲区空间不足。只需检查内存是否不足?我通过在IIS中Delpoy相同的解决方案获得了解决方案,效果很好,我尝试传输1GB文件,它工作正常。我通过在IIS中Delpoy相同的解决方案获得了解决方案,效果很好,我尝试传输1GB文件,它工作正常。这个解决方案非常完美-正在运行“无法将数据写入传输连接:无法执行套接字上的操作,因为系统缺少足够的缓冲区空间或队列已满。”在
绑定
元素中使用
transferMode=“Streamed”
修复了此问题。谢谢!此操作完成得很好-正在进行”无法将数据写入传输连接:无法执行套接字上的操作,因为系统缺少足够的缓冲区空间或队列已满。使用
绑定
元素中的
transferMode=“Streamed”
将其修复。谢谢!