我正在尝试通过配置将自定义消息编码器插入到 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>
为了插入自定义编码器,我尝试遵循自定义绑定(bind)配置
<bindings>
<customBinding>
<binding name="compactBinding">
<compactMessageEncoding>
<binaryMessageEncoding/>
</compactMessageEncoding>
<tcpTransport />
</binding>
</customBinding>
</bindings>
它工作正常。但我仍然想要我之前的设置,如 maxBufferSize、maxReceivedMessageSize、maxBufferPoolSize 等。看起来 <binding>
<customBinding>
下的元素只有 closeTimeout、openTimeout、receiveTimeout、sendTimeout。
如何传递其他信息?
谢谢
最佳答案
尝试添加一个 HttpTransportBindingElement。我认为这会为你做的伎俩。这是 link .
关于c# - WCF - 自定义绑定(bind)的配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4631067/