我试图通过配置将自定义消息编码器插入到WCF管道中 . 之前我使用的是“NetTcpBinding”开箱即用的配置文件
<bindings>
<netTcpBinding>
<binding name="DefaultNetTcpBinding"
maxBufferSize="26214400"
maxReceivedMessageSize="26214400"
maxBufferPoolSize="26214400"
listenBacklog="1000"
maxConnections="1000"
closeTimeout="00:01:00"
openTimeout="00:10:00"
receiveTimeout="00:01:30"
sendTimeout="00:01:00">
<security mode="None"/>
<reliableSession ordered="true" inactivityTimeout="00:01:30" enabled="true"/>
</binding>
</netTcpBinding>
</bindings>
为了插入自定义编码器,我试图遵循自定义绑定配置
<bindings>
<customBinding>
<binding name="compactBinding">
<compactMessageEncoding>
<binaryMessageEncoding/>
</compactMessageEncoding>
<tcpTransport />
</binding>
</customBinding>
</bindings>
它工作正常 . 但我仍然想要我的早期设置,如maxBufferSize,maxReceivedMessageSize,maxBufferPoolSize等 . 似乎 <customBinding>
下的 <binding>
元素只有closeTimeout,openTimeout,receiveTimeout,sendTimeout .
如何传递其他信息?
谢谢
3 回答
尝试添加HttpTransportBindingElement . 我想这对你来说会有所帮助 . 这是link .
尝试在代码中添加配置,如下所示:
并且还在web.config中添加了一个readerQuotas: