none
FileUpload not working with basicHttpBinding and WebHttpBinding RRS feed

  • Question

  • I am trying to add Streaming for File Transfers in WCF. My WCF Service has 2 Endpoints - BasicHttpBinding and WebHttpBinding. 

    If I comment my webhttpbinding in web.config and work only with basichttpbinding, the file upload works fine. This service is in production so I am limited with the changes i can make. 

    I am getting an error when I am updating my service reference to my wcf project in my testproject - Soap Headers are not supported by the None Message Version on the Method that is doing the File Transfers. 

    <endpoint address="basic" 
              binding="basicHttpBinding" 
              bindingConfiguration="myBasicBinding" 
              contract="IService" /> 
    <endpoint address="web" 
              binding="webHttpBinding" 
              behaviorConfiguration="webBehavior"
              bindingConfiguration="webbinding" 
              contract="IService" /> 
    <endpoint address="mex" 
              binding="mexHttpBinding" 
              contract="IMetadataExchange" />

    <binding name="myBasicBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" 
             transferMode="Streamed" messageEncoding="Mtom" >
    <binding name="webbinding" transferMode="StreamedRequest">

    This is the service

     <service name="EmployeeAPI.Service" behaviorConfiguration="MyServiceTypeBehaviors">    

    Method:

        [OperationBehavior]
        public void UploadFile(FileUploadMessage request)
        { ... }
    
    [MessageContract]
        public class FileUploadMessage
        {
            [MessageHeader(MustUnderstand = true)]
            public FileMetaData Metadata;
            [MessageBodyMember(Order = 1)]
            public Stream FileByteStream; }

    I need to resolve the error - does streaming work with WebHttpBinding.

    Do i need to use non-streaming for uploading the file to support both my endpoints? 

    Thanks. 




    • Edited by loki_l77 Monday, June 15, 2015 10:53 PM
    Monday, June 15, 2015 9:45 PM

Answers