'.NET6 Console App returns A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only

I am getting the following error when calling a soap service from a .net6 console app.

A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only

I have no idea why.

However I have seen various posts suggesting setting the enableMtom to true. The problem is that all these posts do this in the XML Configuration file which is not generated in .net6 as far as I am aware (I certainly do not have one in my code).

How do I set it programmatically? If that is indeed what I need to do.

Note that I am using WSHttpBinding as BasicHttpsBinding throws a null object reference error somewhere in the .net libraries...

Strangely the service is IP protected but I get the same error if I am on the VPN (which should be routing me through the whitelisted IP) or if I am not connected to the VPN at all...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source