Service References to a MTOM web services

In VS2013, we tried to add a web service wsdl and the reference.cs is always empty. As per the web service provider, we tried to below command by svcutil.exe to generate the reference.cs and .config file

·        svcutil [wsdl url] /out:references.cs /serializer:XmlSerializer


https://msdn.microsoft.com/en-us/library/aa347733%28v=vs.110%29.aspx


with below configuration for binding generated by the tool, the web service will returns an exception saying something like not expected content type

<basicHttpBinding>

                <binding name="SlsServiceWSSoapBinding">
                    <security mode="Transport" />
                </binding>
            </basicHttpBinding>


We added below messageEncoding="Mtom" and MaxReceivedMessageSize to the bindings, then it works

     <basicHttpBinding>
        <binding name="SlsServiceWSSoapBinding" messageEncoding="Mtom" maxReceivedMessageSize="2000000000">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>


你可能感兴趣的:(Service References to a MTOM web services)