我遇到了著名的WCF錯誤:爲什麼我仍然得到「傳入消息的最大消息大小限額(65536)已超出」錯誤?
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
閱讀前五名谷歌搜索結果這個錯誤後,我仍然沒有什麼可能是錯誤的我服務的配置任何線索/客戶。
我曾嘗試:
注意的是:
小消息被正確地傳送,而是從客戶發送大量消息到當上述發生錯誤服務器。
太大的消息包含一個大約350 KB的字節數組(假定WCF配置爲將base64編碼爲二進制數據)。 (1)雙向通信,其中(2)使用網絡TCP綁定與(3)可靠會話和(4)排序設置(這四點與我已經看到的每個例子都不同錯誤)。
該服務由IIS託管快遞安裝與Visual Studio 2012
這是我的配置。任何提示?
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<bindings>
<netTcpBinding>
<binding name="netTcpEndpoint"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxArrayLength="2147483647"
maxStringContentLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true"
inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="DebugOrientedBehavior"
name="DemoNamespace.PipeService">
<endpoint address="Default.svc"
binding="netHttpBinding"
name="TransportLayerServiceEndpoint"
contract="DemoNamespace.IPipeService" />
<host>
<baseAddresses>
<add baseAddress="http://example.com/Default.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DebugOrientedBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
客戶端配置是這樣的一個:
<bindings>
<netHttpBinding>
<binding name="TransportLayerServiceEndpoint"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647"
maxArrayLength="2147483647"
maxStringContentLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true"
enabled="false" />
<webSocketSettings transportUsage="Always" />
</binding>
</netHttpBinding>
</bindings>
<client>
<endpoint address="ws://example.com/Default.svc/Default.svc"
binding="netHttpBinding"
bindingConfiguration="TransportLayerServiceEndpoint"
contract="PipeServiceReference.IPipeService"
name="TransportLayerServiceEndpoint" />
</client>
非常好。事實上,我錯過了名稱不匹配以及不同類型綁定之間的混亂。萬分感謝。 –
@MainMa - 不客氣。即使在.NET 4.0中引入了默認的端點/綁定MS,配置文件和WCF也會帶來許多麻煩。 – Tim