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.
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.Sign up to join this community
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
<system.webServer> <directoryBrowse enabled="true"/> <security> <requestFiltering> <requestLimits maxAllowedContentLength="4000000000" maxUrl="10999" maxQueryString="9999"/> </requestFiltering> </security> </system.webServer>
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);