2013-08-25 54 views
6

我想從Windows窗體客戶端應用程序訪問WCF服務。在服務器上我的綁定配置是這樣的:」傳入消息的最大消息大小限額(65536)已超出。「。即使設置更大的尺寸

<bindings> 
     <customBinding> 
     <binding name="Wrabind" closeTimeout="00:05:00" openTimeout="00:05:00" 
      sendTimeout="00:25:00"> 
      <textMessageEncoding /> 
      <security authenticationMode="SecureConversation" includeTimestamp="true" 
       messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"> 
      <localClientSettings maxClockSkew="00:30:00" /> 
      <localServiceSettings maxClockSkew="00:30:00" /> 
      <secureConversationBootstrap messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"> 
       <localClientSettings maxClockSkew="00:30:00" /> 
       <localServiceSettings maxClockSkew="00:30:00" /> 
      </secureConversationBootstrap> 
      </security> 
      <httpTransport maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000" 
       allowCookies="true" maxBufferSize="20000000" /> 
     </binding> 
     </customBinding> 
    </bindings> 

正如你可以看到我已經設置了maxReceivedMessageSize 2000萬,但其仍表現出"The maximum message size quota for incoming messages (65536) has been exceeded."例外。我錯過了什麼嗎?

回答

6

也許這個錯誤來自客戶端而不是服務器。確保客戶端配置中存在相同的設置。

+0

謝謝你的工作。 :) –

+0

當我通過WcfTestClient調試服務時,我得到了同樣的錯誤。我在綁定中增加了大小。你能給我一個辦法嗎?我已經發布了我的問題http://stackoverflow.com/questions/22934530/two-endpoint-with-two-binding-configuration-for-a-service幫助我 – Programmer

1

here: -

您可能需要添加 「binding.MaxBufferSize = 2147483647」 爲好。一旦您更新或重新配置服務參考,「ServiceReferences.ClientConfig」將自動更新。因此,如果您使用WCF服務庫的「App.config」在服務級別提供了正確的綁定配置,則該配置將自動繼承到使用Silverlight的客戶端。但是,如果您在代碼中動態創建綁定,所有這些都不會生效。

2

在這種情況下,WCF服務器端設置無關緊要。客戶端綁定配置是你的敵人...

+0

...以及「WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10」。真...? – KristoferA

相關問題