Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 将netTcpBinding TransportWithMessageCredential安全性转换为customBinding_Wcf_Nettcpbinding - Fatal编程技术网

Wcf 将netTcpBinding TransportWithMessageCredential安全性转换为customBinding

Wcf 将netTcpBinding TransportWithMessageCredential安全性转换为customBinding,wcf,nettcpbinding,Wcf,Nettcpbinding,我有一个带有netTcpBinding的WCF服务,我想向它添加GZip压缩 以下是我当前的绑定: <netTcpBinding> <binding> <security mode="TransportWithMessageCredential"> <message clientCredentialType="Us

我有一个带有netTcpBinding的WCF服务,我想向它添加GZip压缩

以下是我当前的绑定:

        <netTcpBinding>
            <binding>
                <security mode="TransportWithMessageCredential">
                    <message clientCredentialType="UserName" />
                </security>
            </binding>
        </netTcpBinding>

但要添加GZip压缩,我需要将其转换为customBinding

因此,我认为新绑定必须如下所示:

        <customBinding>
            <binding>
                <security ??? />
                <binaryMessageEncoding compressionFormat="GZip" />
                <tcpTransport />
            </binding>
        </customBinding>


如何在customBinding中实现netTcpBinding的mode=“TransportWithMessageCredential”和clientCredentialType=“UserName”?

您可以参考SecurityBindingElement身份验证模式:@Ding Peng谢谢您的评论,但我找不到与我的netTcpBinding配置等效的正确身份验证模式!由于clientCredentialType=“UserName”,我认为它必须是以UserName开头的身份验证模式之一。但是哪一个呢?UserNameForCertificate、usernameforslagreemented或UserNameOverTransport?您可以使用UserNameOverTransport。这有一个类似的问题:@Ding Peng感谢您的评论,在将authenticationMode设置为UserNameOverTransport后,我收到了以下错误:“CustomBinding…合同配置了需要传输级别完整性和机密性的身份验证模式。但是传输无法提供完整性和机密性。”所以我在前面加了一个,它解决了这个问题。