.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Uploading Large files via Web Service | HTTP Error 413 - Request Entity Too Large.

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net

Hello all -

I am trying to implement a Web Service, which accepts a binary file as a byte array for one of its parameters.  It's workings are based on this article:

Anyhow, the size of the file can be significant as the types of files being uploaded through the service are MP4 Video files.  The service works on my WinXP SP2 localhost, but when I implement it onto a 2003 Server and try to consume the service, I get the following error back from the web service:
The request failed with HTTP status 413: Request Entity Too Large.

I do a little searching around and find a few articles indicating that I need to adjust my "MaxReadAheadLength" property in IIS.  A good example of one of those articles is here:

The suggestion from the article is to execute the following command on the web server:
cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 204800 

FYI, the adsutil.vbs is in your IIS's AdminScripts directory.  I'm guessing that the /1/ part of the command is th

View Complete Post

More Related Resource Links

HTTP 400 Bad Request Error when uploading to document library


I am running MOSS 3007 Standard on Windows 2003. When trying to upload files larger than about 29Mb, I am getting an HTTP 400 Bad request error. The error states "HTTP Error 400 - Request is badly formed." I am able to successfully upload a 28Mb file. Sharepoint is configured to accept files up to 75Mb.

I have done a fair amount of research on this, but none of the solutions seem to apply to our environment. The two most likely candidates do not apply, for example we are NOT running URLScan (there are a variety of solutions suggesting this could be an issue with uploads of 30Mb or more), and we are on 2003 with IIS6, so again the issue relating to 2008 and IIS7 do not apply.

The "Request is badly formed" part of the request is particularly confusing as most issues I have come across where this error is the symptom point to errors in custom code that is trying to talk to SharePoint. We have done none of our own custom coding and this error is occurring when attempting a simple upload to a document library.

Trying to drag and drop the file across when the document library is open in windows explorer also fails.

I did come across someone saying they had a similar problem which was caused by a damaged content database, however in this case, it is occuring regardless of which content database I use, so either they are all corrupt

What is the best Hosting model when Uploading Large Files via WCF?

I am building a WCF service where besides regular CRUD operations, it porovides methods to upload large (upto 15MB each) files. The service will serve a number of "clients" that will send data to our back-end. Now, while some of the clients are ok with sending one file at time, others would like to be sending these files in batches (i.e. several files at a time).... My questions: What is the best option for hosting this service considering the environment (see below)?  Will IIS be able to support it or will it time out? I know you can increase timeout limit in config file but how will it handle a batch of large files at a time? Is windows service a better option here? What are the dis/advantages of IIS vs Win Srvc in this scenario?  Current Environment: Win 2003 Server w/IIS 6.0 and WCF (.NET 3.5) Thanks in advance!

WCF webservice: HTTP/1.1 400 Bad Request while sending large input

I am connecting to a WCF based webservice. For certain methods, the input contains a list of objects/structures. When the number of items in this list increases beyond a certain number, the service fails with HTTP/1.1 400 Bad Request when I try to test the same using SOAPUI. I tried changing the web.config file with the following changes: <httpRuntime maxRequestLength="2097151" /> <binding name="basicHTTP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:01:00" maxReceivedMessageSize="4194304" maxBufferSize="98547" maxBufferPoolSize="258547"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> </binding>   Kangkan

400 Bad Request when trying to send large file to service using basichttp streaming.


Hi All,


I am trying to send the large file (approx 1.5GB) to the WCF service for upload using basic http streaming.

I have increased all the timeouts and quotas in the server and client's config files to quite large values, but still I am getting Bad Request error on the client.


Also the Bad request message is returned always in 1 minute 30 seconds after sending the request to server.


What the most unusual thing is when I use Fiddler or Charles to debug communication, everything works fine. Is it something like fiddler is pinging the IIS or service and hence its not getting timeouted or like that?




Following are the details:

Server Config:


 <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

How to go around the file size issue when uploading large files?



In my application the user uploads three files ( Resume, Cover Letter, Selection Creteria).

I want users not to upload more then 4 MB files, so In my web.confing file I have allowed max of 5 MB. <httpRuntime maxRequestLength="5000"/>. I did this so that I can validate the file and give user a message that they are trying to upload more then 4 MB file.

It all works fine if the user is only uploading resume. But if the user uploads all three files of size 4MB then my validation does not work and it goes to connection time out.

How can i handle the validation to check the file size of all 3 files?


WCF Service Bad request with large data

What are Maximum Limit for maxReceivedMessageSize attribute in config file. What are the consequences if we set that and other attribute like maxBufferSize, maxBufferPoolSize, maxReceivedMessageSize to maximum value. Are there any performance drawback.


Document Conversion of large files



My MOSS 2007 environment fires OutOfMemory exceptions when attempt to launch a custom Document Converter on files larger then 50 MB (Video files) . Because my Document Converter is implemented by a standalone executable, I'm figuring these exceptions are fired by Sharepoint Work process, on downloading/uploading from/to temp folder, not by my custom converter.

If this is the case, can I apply any workarounds on server configuration ? I tried with /3GB switch without luck. Maybe SP1 will address this issue too ?



How to manage large .trc files?

Hello everbody,        Sir, with raid 10  with enough arrays to hold files saperately.    Is an array of raid 10 will be identified as one logical drive? such as c:, d: e.t.c.   Actually I want to store trace files on server to capture representative workload for DB Tuning with DTA. As i know that will be very large in size as my OLTP DB gets very busy at 8 a.m. to 7 p.m. and less busy at diff. time and i don't want any event to be missed out due to lack of resources. So how to manage this?   Can i attach ext. HD to the dedicated sql server to hold .trc files? Is it advisable?   Pl provide any available link for config. best practices for raid 10. Or standard config. for raid 10 to get optimum performance. Or any suggestion regarding this issue.   Thanks in advance  

Server ERROR: An error occurred during the parsing of a resource required to service this request.

I have created one asp.net 2.0 application and created a setup project. I run this setup in my local machine, the application run fine, but i uploaded into online server I met the following parser error.How to solve this error? Kindly help me. Very urgent.. Kamal....

While calling Web service gets exception "The request failed with HTTP status 401: Unauthorized"

Hi All, I created a ASP.NET web service, which was hosted on default visual studioserver, and on excecution of webservice it run .exe file which in turn update xml file. Now i hosted this webservice on IIS 6.0 server, and when i run the service, itfails to execute the exe.When i run it on debug mode, i never get any exception.Code...public string HelloWorld()    {        Process myProcess = new Process();        try        {            myProcess.StartInfo.UseShellExecute = false;            // You can start any process,             myProcess.StartInfo.FileName = @"E:\Projects\some.exe";            myProcess.StartInfo.CreateNoWindow = true;            myProcess.Start();            myProcess.Close();            myProcess.Dispose();            return "Suceess";         }&n

Error: The search request was unable to connect to the Search Service.

When attempting a search, I get the the error message "The search request was unable to connect to the Search Service. "  The search sevice has been started in Central Administration.  Does anyone have suggesting as to how to troubleshoot this issue?   Thank you in advance for your help.

Server generate frequently large mdmp files

Hi, I have running MS SQL Server 2005. Server generate frequently large mdmp files which took c: drive space. kindly tell how i stop creating these and keep the c: drive space. thx iffi

Storing large files (10gb) in MOSS.

Hello, We are planning to develop a portal with few lists in the portal. We have a requirement to store huge files of approximately 10GB in size. Can any one let me know If we can have a mechanism where in we can only save the file meta data to a MOSS list and save the actual file to a file share (Data Center)? I am looking forward to a generic service(WCF) which can perform this functionlity. If it is possible can some one provide a series of steps to achieve this. Thanks,kesari suresh

sql server start service error "The request failed or the service didn't respond in a timely fashio

I cannot start sql server 2008 after repair windows. sql server (MSSQLSERVER) not start dialog message "The request failed or the service didn't respond in a timely fashion.Consult the event log or other applicable error logs for details"  I open even log (control panel >> administration >> event viewer) find error log with sql server it notice Could not open error log file 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\ERRORLOG'. Operating system error = 5(failed to retrieve text for this error. Reason: 1815) I open file ERRORLOG.5 but I don't understand where I should fix?  I copy errorlog.5 on this webboard  Please help me! thank you   2010-08-20 08:16:52.89 Server      Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)  Jul  9 2008 14:43:34  Copyright (c) 1988-2008 Microsoft Corporation  Standard Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 3) 2010-08-20 08:16:52.89 Server      (c) 2005 Microsoft Corporation. 2010-08-20 08:16:52.89 Server      All rights reserved. 2010-08-20 08:16:52.89 Server      Server process ID is 2248. 2010-08-20 08:16:52.89 Server      Authentication mode is MIXED. 2010-08-20 08:16:52.89 Server  &

Uploading Large File (40mb) fails... (webhttpbinding) (Azure)

I'm using javascript to upload a file to my WCF service hosted on Azure.  (40 mb file) Here is the snippets from the web.config for the service: <system.serviceModel> <bindings> <webHttpBinding> <binding transferMode="Streamed" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00" name="WebConfiguration"> </binding> </webHttpBinding> </bindings> <behaviors> <endpointBehaviors> <behavior name="RestfulEndpointBehavior"> <webHttp/> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="CPUploadServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpGetUrl=""/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> <services> <service name="CPUpload" behaviorConfiguration="CPUploadServiceBehavior"> <endpoint add

PUT method gives error 400 "Bad Request" in WCF REST Service Application

I am trying to learn WCF REST Services through http://blogs.msdn.com/endpoint/archive/2010/01/14/updating-state-in-wcf-webhttp-services.aspx , It's a link of Part 3 of 12 part blog series. Now I am trying the same stuff given in the part 3 with my own Entities and Entity Model instead of what is given in the blog. Here is my full project I am working on .. http://cid-9e3f62c0688824b0.skydrive.live.com/self.aspx/.Public/pronerveEPMS.zip For comparision with the code shown in the Blog I am following, you can download the zip file of the project from the same link given here at starting (At the end of the blog and before comments starts). And here is the method in Program.cs file of console project in my application that raises the exception.....        private static Role UpdateRole(HttpClient hc, Role role1)        {            Console.WriteLine("Updating Role {0} : ",     role1.RoleID);            Console.WriteLine();            string updateURI = "Roles/" + role1.RoleID.ToString();            HttpContent content = HttpContentExtensions.CreateDataContract(role1);            using (HttpResponseMessage response = hc.Put(upd
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend