【发布时间】:2009-11-25 23:58:03
【问题描述】:
我正在使用自定义绑定设计双工通道 wcf 服务。目前,当我编译我的类库时,出现以下错误:
传输模式流式不是 支持 ReliableSessionBindingElement。
下面是我的 App.config:
<service behaviorConfiguration="transferServiceBehavior"
name="API.FileTransfer.FileTransferService">
<endpoint address="json"
behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding"
bindingConfiguration="jsonWeb"
name="MyJSONFileTransferEP"
contract="API.FileTransfer.IJSONFileTransferService" />
<endpoint address="pox"
behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding"
bindingConfiguration="poxWeb"
name="MyPOXFileTransferEP"
contract="API.FileTransfer.IPOXFileTransferService" />
<endpoint address="soap"
behaviorConfiguration="NetTcpEPBehavior"
binding="netTcpBinding"
bindingConfiguration="netTcpWeb"
name="MySOAPFileTransferEP"
contract="API.FileTransfer.ISOAPFileTransferService" />
<endpoint address="mex"
binding="mexTcpBinding"
bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:2544/filetransfer/" />
<add baseAddress="net.tcp://localhost:2544/filetransfer/" />
</baseAddresses>
</host>
</service>
我得到的错误是指我的自定义绑定,它同时具有可靠会话和复合双工绑定元素:
<customBinding>
<binding name="netTcpCustom"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00">
<reliableSession />
<compositeDuplex />
<oneWay />
<windowsStreamSecurity protectionLevel="None" />
<mtomMessageEncoding />
<tcpTransport maxBufferPoolSize="524288"
maxReceivedMessageSize="2147483647"
connectionBufferSize="8192"
hostNameComparisonMode="StrongWildcard"
channelInitializationTimeout="00:01:00"
maxBufferSize="2147483647"
maxPendingConnections="20"
maxOutputDelay="00:00:00.2000000"
maxPendingAccepts="5"
transferMode="Streamed"
listenBacklog="20"
portSharingEnabled="false"
teredoEnabled="false">
<connectionPoolSettings groupName="default" leaseTimeout="00:05:00"
idleTimeout="00:02:00" maxOutboundConnectionsPerEndpoint="20" />
</tcpTransport>
</binding>
</customBinding>
经过一番搜索,我发现在使用可靠消息传递 (WS-RM) 时不能使用流式传输。这是因为 WS-RM 需要将签名/校验和作为一个整体应用于整个消息等;这在流传输模式时是不可能的,只有缓冲传输模式。
由于我正在设计一个双工绑定通道并且我正在使用此服务来上传大文件,因此我需要 transferMode = streamed 和可靠的会话绑定元素。
有人知道如何攻击这个吗?你能告诉我它是怎么做的吗?
提前致谢。
【问题讨论】: