[英]Transfer large data object via WCF client to WCF server
我正在尝试通过WCF从WinForms客户端传输大型数据对象。
当客户端尝试从服务器获取对象时,传输成功; 但是当客户端尝试将对象发送到服务器时,出现错误!
错误是:
在System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException,HttpWebRequest请求,HttpAbortReason abortReason)
在System.ServiceModel.Channels.RequestChannel.Request(消息,TimeSpan超时)在System.ServiceModel.Channels.RequestChannel.ClientReliableChannelBinder1.RequestClientReliableChannelBinder
1.OnRequest( TRequestChannel通道,消息消息,TimeSpan超时,MaskingMode maskingMode)
在System.ServiceModel.Channels.ClientReliableChannelBinder1.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超时)
我尝试添加行为属性DataContractSerializer
并将其设置为最大值。 传输仅以一种方式起作用-从服务器到客户端! 另一方面-从客户端到服务器,它不起作用!
谢谢您的帮助。
尝试将以下参数添加到您的web.config文件中(根据情况调整值):
<behaviors>
<serviceBehaviors>
<behavior name="">
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
</serviceBehaviors>
</behaviors>
...
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="512000000" />
</requestFiltering>
</security>
</system.webServer>
有几种设置可以控制邮件的最大大小
请参阅: http : //geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.