سؤال

I am struggling at the moment to come up with the right config for a Web Service client build via WCF / Service Reference. I was able to create the binding and configure the endpoint programmatically, but ideally I would like these settings to go into a WCF config file. However I am not sure how to define the customer binding in there that would match the following settings (I have left out the more detailed settings for the mtom and https part...):

    Dim mtom As MtomMessageEncodingBindingElement =
        New MtomMessageEncodingBindingElement(MessageVersion.Soap12, Encoding.UTF8)

    Dim https As HttpsTransportBindingElement = New HttpsTransportBindingElement()

    Dim binding As CustomBinding = New CustomBinding()
    binding.Elements.Add(mtom)
    binding.Elements.Add(https)

    client.Endpoint.Binding = binding

I know that I need the customBinding element and refer to the element in the client section, but I can't seem to get the custom binding working as in the code above. Any help is appreciated.

Thanks all!

هل كانت مفيدة؟

المحلول

The equivalent custom binding in config is shown below.

<customBinding>
  <binding name="SO_12399887">
    <mtomMessageEncoding messageVersion="Soap12" writeEncoding="utf-8" />
    <httpsTransport />
  </binding>
</customBinding>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top