locked
Can we upload a file size of 500MB using WCF Service? RRS feed

  • Question

  • User-896252741 posted

    I have written a WCF Service to upload a file. So far i am able to upload a file size of 300MB. When i tried further i am receiving an error mentioning .

    "The underlying connection was closed: The connection was closed unexpectedly."

    Thursday, November 7, 2013 7:04 AM

Answers

  • User260886948 posted

    Hi,

    Yes, of coruse, we can upload a file size of 500MB, The max size can be upload is almost 2GB.

    In order to upload larger file, please try to change the some setting in the config file as following:

    <binding name="BasicHttpBinding_IService" closeTimeout="04:01:00"
         openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00"
         allowCookies="false" bypassProxyOnLocal="false" 
         hostNameComparisonMode="StrongWildcard"
         maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
         maxReceivedMessageSize="2147483647"
         messageEncoding="Text" textEncoding="utf-8" 
         transferMode="Streamed"
         useDefaultWebProxy="true">
      <readerQuotas maxDepth="128" 
          maxStringContentLength="2147483647" maxArrayLength="2147483647"
          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    

    For more information, please try to refer to the following article:
    #How to upload large file:
    http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP .

    Best Regards,
    Amy Peng


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 7, 2013 10:30 PM
  • User-1623675128 posted

    You can even change the settings of WCF service in IIS7 ( I assume you are using IIS7) as mentinoed in below link; we had similar issue with big files but with ASPNET website we did the same mentioend in the link.

     

    http://www.web-site-scripts.com/knowledge-base/article/AA-00696/0/Increasing-maximum-allowed-size-for-uploads-on-IIS7.html

    hope it helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 7, 2013 10:54 PM
  • User-488622176 posted

    Can be 2 things:

    • default limitations of wcf configuratoin : change de configuration parameters to increase the default values and you can go on (use links other participants gave you)
    • internal exception in the service

    I'm not excluding the 2nd option. We'd need more info on the exception internals. You can also put a try-catch between your service implemenation code, and use the FaultException to escaled service errors in a controlled way (http://msdn.microsoft.com/en-us/library/system.servicemodel.faultexception(v=vs.110).aspx)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 8, 2013 6:19 AM

All replies

  • User260886948 posted

    Hi,

    Yes, of coruse, we can upload a file size of 500MB, The max size can be upload is almost 2GB.

    In order to upload larger file, please try to change the some setting in the config file as following:

    <binding name="BasicHttpBinding_IService" closeTimeout="04:01:00"
         openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00"
         allowCookies="false" bypassProxyOnLocal="false" 
         hostNameComparisonMode="StrongWildcard"
         maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
         maxReceivedMessageSize="2147483647"
         messageEncoding="Text" textEncoding="utf-8" 
         transferMode="Streamed"
         useDefaultWebProxy="true">
      <readerQuotas maxDepth="128" 
          maxStringContentLength="2147483647" maxArrayLength="2147483647"
          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    

    For more information, please try to refer to the following article:
    #How to upload large file:
    http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP .

    Best Regards,
    Amy Peng


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 7, 2013 10:30 PM
  • User-1623675128 posted

    You can even change the settings of WCF service in IIS7 ( I assume you are using IIS7) as mentinoed in below link; we had similar issue with big files but with ASPNET website we did the same mentioend in the link.

     

    http://www.web-site-scripts.com/knowledge-base/article/AA-00696/0/Increasing-maximum-allowed-size-for-uploads-on-IIS7.html

    hope it helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 7, 2013 10:54 PM
  • User-488622176 posted

    Can be 2 things:

    • default limitations of wcf configuratoin : change de configuration parameters to increase the default values and you can go on (use links other participants gave you)
    • internal exception in the service

    I'm not excluding the 2nd option. We'd need more info on the exception internals. You can also put a try-catch between your service implemenation code, and use the FaultException to escaled service errors in a controlled way (http://msdn.microsoft.com/en-us/library/system.servicemodel.faultexception(v=vs.110).aspx)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 8, 2013 6:19 AM