[英]Transfer large data object via WCF client to WCF server
I'm trying to transfer a large data object from a WinForms client via WCF. 我正在尝试通过WCF从WinForms客户端传输大型数据对象。
When the client tries to get the object from the server, the transfer succeeds; 当客户端尝试从服务器获取对象时,传输成功; but when the client tries to send the object to the server, I get an error!!
但是当客户端尝试将对象发送到服务器时,出现错误!
The error is: 错误是:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
在System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException,HttpWebRequest请求,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.Channels.ClientReliableChannelBinder1.RequestClientReliableChannelBinder
1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)在System.ServiceModel.Channels.RequestChannel.Request(消息,TimeSpan超时)在System.ServiceModel.Channels.RequestChannel.ClientReliableChannelBinder
1.RequestClientReliableChannelBinder
1.OnRequest( TRequestChannel通道,消息消息,TimeSpan超时,MaskingMode maskingMode)
at System.ServiceModel.Channels.ClientReliableChannelBinder1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode) at System.ServiceModel.Channels.ClientReliableChannelBinder
1.Request(Message message, TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.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)在System.ServiceModel.Channels.ClientReliableChannelBinder
1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode) at System.ServiceModel.Channels.ClientReliableChannelBinder
1.Request(消息,TimeSpan超时)在System.ServiceModel.Security.Security.SecuritySessionClientSettings`1。 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时)在System.ServiceModel.Channels.ServiceChannel.Call处的SecurityRequestSessionChannel.Request(消息消息,TimeSpan超时)(字符串操作,布尔型单向,ProxyOperationRuntime操作,Object [] System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)的System.ServiceModel.Channels.ServiceChannelProxy.Invoke的ins,Object [] outs,TimeSpan超时)
I try to add the behavior attribute DataContractSerializer
and set it to max value. 我尝试添加行为属性
DataContractSerializer
并将其设置为最大值。 The transferring works only one way - from the server to the client! 传输仅以一种方式起作用-从服务器到客户端! On the other side - from the client to the server it doesn't work!
另一方面-从客户端到服务器,它不起作用!
Thank you for your help. 谢谢您的帮助。
Try adding the following parameters to your web.config file (adapt the value for your case): 尝试将以下参数添加到您的web.config文件中(根据情况调整值):
<behaviors>
<serviceBehaviors>
<behavior name="">
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
</serviceBehaviors>
</behaviors>
...
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="512000000" />
</requestFiltering>
</security>
</system.webServer>
There are several settings that control the max size of a message 有几种设置可以控制邮件的最大大小
See: http://geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx 请参阅: http : //geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.