2016-05-06 155 views
0

我正在使用靜態IP上動態代理創建的WCF服務。 Url =「http://」+ staticIP +「/CM.svc」WCF服務 - 動態代理上的400錯誤請求錯誤

BasicHttpBinding binding = new BasicHttpBinding();

也有set binding.MaxReceivedMessageSize = 2147483647; MAXBUFFERSIZE,MaxbufferPoolsize,Receivetimeout,Opentimeout,closetimeout,的SendTimeout,transferMode ...

EndpointAddress endpoint = new EndpointAddress(Url); 
ChannelFactory<ICMOnlineApp> factory = new ChannelFactory<ICmOnlineApp>(binding, endpoint); 

foreach(var operation in factory.Endpoint.Contract.Operations) 
{ 
operation.Behaviors.find<DataContractSerializerOperationBehavior>().DataContractResolver = new DynamicTypeResolver(); 

ICMOnlineApp proxy = factory.CreateChannel(); 

return proxy; 

} 

此外,我已經做了在WCF服務的web.config文件中的所有設置。

我仍然收到此錯誤。請指導。

+1

什麼是您的客戶實際發送到服務?你有沒有檢查過什麼電線?您可以使用wireshark,tcpmon或爲此啓用WCF跟蹤。 – Juan

+0

我發送約21個參數給webservice。包括10個數據表,1個數據集,1個散列表和其他字符串/小數參數。我已啓用WCF跟蹤。它給了我「傳入消息(65536)的最大消息大小限額已經超出了。要增加限額,請在相應的綁定元素上使用MaxReceivedMessageSize屬性。 – Jaykishan

+0

您是否已在客戶端和服務器中設置屬性? – Juan

回答

0

對於WCF跟蹤中顯示的錯誤看起來就像您發送消息的服務不允許大小的消息。

"The maximum message size quota for incoming messages(65536) has been exceed" 

更改WCF服務,客戶端的配置,以允許大小的郵件:

<bindings> 
    <basicHttpBinding> 
     <binding name="basicHttp" allowCookies="true" 
       maxReceivedMessageSize="2147483647" 
       maxBufferSize="2147483647" 
       maxBufferPoolSize="2147483647"> 
      <readerQuotas maxDepth="32" 
       maxArrayLength="2147483647" 
       maxStringContentLength="2147483647"/> 
     </binding> 
    </basicHttpBinding> 
</bindings> 
+0

我有已經在我的WCF web.config文件中做了這個以及動態綁定。讓我知道是否有任何其他解決方案。 – Jaykishan

+0

你可以在WCF服務和你在動態綁定中使用的代碼顯示你的配置文件嗎?然後? – Juan

+0

請在下面找到配置文件。 – Jaykishan

相關問題