Saturday, 9 January 2021

The value 'TransportWithMessageCredential' is not supported in this context for the binding security property 'securityMode'. - .NET Core 3.1

I had an .NET Core 3.1 WCF client trying to connect to a WCF service over HTTPS, passing a username and password using WSE Security.

Writing the client code:

var binding = new BasicHttpsBinding();
binding.Security.Mode = BasicHttpsSecurityMode.TransportWithMessageCredential;

I was getting the error:

The value 'TransportWithMessageCredential' is not supported in this context for the binding security property 'securityMode'.

This was because the default project installed System.Service model assemblies, version 4.4. Upgrading them to 4.7 or higher fixes this.

No comments:

Post a comment