0

I have a WCF Service with netTcpBinding and I want to add GZip compression to it.

Here is my current binding:

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

But to add GZip Compression, I need to convert it to a customBinding.

So I think the new binding must looks like this:

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

How can I achieve mode="TransportWithMessageCredential" and clientCredentialType="UserName" of netTcpBinding in customBinding?

Reza HN
  • 33
  • 6
  • You can refer to SecurityBindingElement Authentication Modes: https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/securitybindingelement-authentication-modes – Ding Peng Apr 13 '21 at 05:04
  • @Ding Peng thanks for your comment, but I can't find the right authenticationMode equivalent to my netTcpBinding config! Because of clientCredentialType="UserName", I think it must be one of the authenticationModes that starts with UserName. but which one of them? UserNameForCertificate, UserNameForSslNegotiated or UserNameOverTransport? – Reza HN Apr 13 '21 at 05:59
  • 1
    You can use UserNameOverTransport. This has a similar issue: https://stackoverflow.com/questions/7676783/equivalent-custom-wcf-binding-for-basichttpbinding-with-transportwithmessagecred – Ding Peng Apr 14 '21 at 02:28
  • @Ding Peng thanks for your comment, after setting authenticationMode to UserNameOverTransport, I got this error "The CustomBinding ... contract is configured with an authentication mode that requires transport level integrity and confidentiality. However the transport cannot provide integrity and confidentiality." So I added before and it fixed the problem. – Reza HN Apr 14 '21 at 04:29

0 Answers0