[英]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.