Domanda

I have a WCF service whose endpoint uses a basicHttpBinding with the messageEncoding set to Mtom. I'm using transport security with basic credentials.

<binding name="basic" messageEncoding="Mtom">
  <security mode="Transport">
    <transport clientCredentialType="Basic" />
  </security>
</binding>

The client is a Windows 8 Store application:

BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

var client = new MyClient(binding, new EndpointAddress("https://..."));
client.ClientCredentials.UserName.UserName = "...";
client.ClientCredentials.UserName.Password = "...";

var x = await client.GetX();

If I use Mtom encoding I get a nasty ProtocolException on the GetX call. If I use Text encoding it works.

Is there any way to make the service work with Mtom encoding?

È stato utile?

Soluzione

MTOM support is not in the subset of WCF included in the .NET Framework for Windows Store applications, so the simple answer is no - it's not possible to call it. The more complete answer is that it's in theory still possible to call it, but you'd need to write a custom encoder to deal with the MTOM encoding yourself, which is not an easy thing to do.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top