While we are uploading images using Coreservice StreamUploadClient.UploadBinaryContent method we are getting the below error. "The remote server returned an error: (411) Length Required." Apprciate your help.

Thanks, Prasanna

  • Are you using the out of the box core service client? Or have you generated one yourself? – Likhan Dec 6 '15 at 10:53

HTTP status 411 (Length Required) is usually raised when you are doing a POST but haven't specified the size of the body of the request (i.e. the length of the content that you are saving).

Since you didn't post your code, I can't give you a more specific suggestion than: look at the properties of the class you are using to do the request. For instance, if using an HttpWebRequest object there is a ContentLength property that you should set to the number of bytes of the file you are uploading.


In your application, look at increasing the timeout and maxRequestLength. Here's a sample web.config

    <directoryBrowse enabled="true"/>
                <requestLimits maxAllowedContentLength="4000000000" maxUrl="10999" maxQueryString="9999"/>

  • Thank you Robert, where should we mention these settings if we use app.config for console application – Prasanna K Gollamudi Jul 10 '15 at 3:25
  • I hope you can add these setting in the IIS as well and it will take care the internal details for you – Pankaj Gaur Jul 10 '15 at 11:05
  • Hi Robert, Still the issue persists,we are using streamUpload_basicHttp and the below configuration <binding name="streamUpload_basicHttp" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="StreamedRequest" messageEncoding="Mtom" openTimeout="05:00:00" sendTimeout="05:00:00" receiveTimeout="05:00:00" closeTimeout="05:00:00"> <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/> </binding> – Prasanna K Gollamudi Jul 13 '15 at 16:26

if your not sure how to set up the binding configuration in web/app config file, u can also add the config on ur code directly see the below code.

BasicHttpBinding basicHttpBinding = new BasicHttpBinding { MaxReceivedMessageSize = 10485760, ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas { MaxStringContentLength = 10485760, MaxArrayLength = 10485760 }, MessageEncoding = WSMessageEncoding.Mtom, Security = new BasicHttpSecurity { Mode = BasicHttpSecurityMode.None, } }; EndpointAddress remoteAddress = new EndpointAddress("http://domain paths/CoreService2011.svc/streamUpload_basicHttp"); StreamUploadClient client = new StreamUploadClient(basicHttpBinding, remoteAddress);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.