문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top