none
WCF MTOM upload fails with basicHttp, works with wsHttp RRS feed

  • Question

  • I'm working on a web service that's exposed with two binding types. One basicHttp and one wsHttp endpoint. Both are configured identically where possible, the only difference being that the basicHttp binding uses transferMode="streamed" which is not available with wsHttpBinding.

    The service is used to upload images to a file server using the basicHttpBinding endpoint, and is working well in almost all cases. Large files (> 100MB), small files (< 1MB), the failure does not appear to be size related.

    One image, however, will not upload via the basicHttp endpoint. It does upload via the wsHttp endpoint. When I enabled tracing at the service, I see one exception logged when I attempt an upload via the basicHttpBinding endpoint:

    Error creating a reader for the MTOM message

    Stack trace follows:

    System.ServiceModel.Channels.MtomMessageEncoder.TakeStreamedReader(Stream stream, String contentType)
    System.ServiceModel.Channels.MtomMessageEncoder.ReadMessage(Stream stream, Int32 maxSizeOfHeaders, String contentType)
    System.ServiceModel.Channels.HttpInput.ReadStreamedMessage(Stream inputStream)
    System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception&amp; requestException)
    System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
    System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
    System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
    System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
    System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    Here are the binding specifics.

        <bindings>
          <wsHttpBinding>
            <binding name="wsBinding"
                     closeTimeout="00:10:00"
                     openTimeout="00:10:00"
                     receiveTimeout="00:10:00"
                     sendTimeout="00:10:00"
                     maxBufferPoolSize="1073741824"
                     maxReceivedMessageSize="2147483646"
                     messageEncoding="Mtom" >
              <security mode="Transport">
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </wsHttpBinding>

          <basicHttpBinding>
            <binding name="Basic_ASMX"
                     closeTimeout="00:10:00"
                     openTimeout="00:10:00"
                      receiveTimeout="00:10:00"
                      sendTimeout="00:10:00"
                      maxBufferPoolSize="1073741824"
                      maxReceivedMessageSize="2147483646"
                      messageEncoding="Mtom"
                      transferMode="Streamed">
              <security mode="Transport">
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>

     
    Tuesday, June 4, 2013 6:38 PM

Answers

All replies