none
Consuming Files over WCF web service RRS feed

  • Question

  • Hi,

    I am developing a wcf web service which is responsible for uploading a document. In order to upload a document, there will be another application which would give a call to my service and send these files.

    1. What is the appropriate data type that I should have? (should it be Stream) Suggest, if there is anything better.

    2. Also that will it possible to consume the files > 2Mb? For this, what provision do I need to make here?

    3. Since this is going to get hosted over Internet, what should be the binding used? Is basisHttp not a preferred one against wsHttpBinding?

    Kindly reply.

    Thanks,


    AC

    Tuesday, December 17, 2013 5:30 PM

Answers

  • Hi,

    >>1. What is the appropriate data type that I should have? (should it be Stream) Suggest, if there is anything better

    Yes, I think the stream will be more better.

    >>2. Also that will it possible to consume the files > 2Mb? For this, what provision do I need to make here?

    Of course, by default the data can be transfer is 64kb, then you should do some configure. Then after that we can transfer the data almost 2GB:

     <binding name="myBasicBinding" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" openTimeout="00:50:00" sendTimeout="00:50:00" receiveTimeout="00:50:00" closeTimeout="00:50:00">
                    <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     </binding>

    >>3. Since this is going to get hosted over Internet, what should be the binding used? Is basisHttp not a preferred one against wsHttpBinding?

    By default if we use the basichttpbinding then the security mode is none. So if you want to secure your wcf service, then you can use the wsHttpBinding, or you can set the security mode for the basichttpbinding:

    <basicHttpBinding>
            <binding name="myBasicBinding" openTimeout="00:50:00" sendTimeout="00:50:00" receiveTimeout="00:50:00" closeTimeout="00:50:00" maxReceivedMessageSize="2147483647">
              <security mode="Message">
                <message clientCredentialType="Certificate"/>
              </security>
            </binding>
          </basicHttpBinding>

    Best Regards,
    Amy Peng


     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Wednesday, December 18, 2013 7:47 AM
    Moderator