Posting data to a HttpHandler greater then ~29MB gives a 404 error

 

I am testing a HttpHandler that accepts XML. It works fine when a small amount of data is posted but if I post data larger then approx 29mb, I get a asp.net 404 Error.

I am posting to the handler from another handler in the same project and I have tried 2 methods - 1. HttpWebRequest with "POST" 2. WebClient with UploadFile() and UploadData()

I get the same 404 error when the posted data is above 28.6 MB.

I also tried putting a breakpoint right in the beginning of the receiving handler and debugging. It is never hit. Appears like the handler was never called. Works ok for smaller sized data.

I already have the following setting. What am I doing Wrong?

<httpRuntimemaxRequestLength="1048576"/>

EDIT: I have also tried posting to a different handler that doesnt not consume posted data, just to test, but the results are the same. Environment: Win 7, IIS 7.5, .net 3.5, VS 2008 

share | improve this question
 
1  
 
I already have it set way high - maxRequestLength="1048576" –  Vaibhav Garg  Apr 23 '10 at 4:39
 
Are you uploading a file or posting a page? –  Robert Harvey  Apr 23 '10 at 4:41
 
I have tried both uploading as a file (using Webclient) as well as posting (HttpWebRequest). the concerned data is a XML document –  Vaibhav Garg  Apr 23 '10 at 5:13

2 Answers

up vote 3 down vote accepted

I discovered that the problem is with IIS 7 and above. It requires the max request length to be set in a different place.

See the following links -

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22943810.html

http://msdn.microsoft.com/en-us/library/ms689462%28VS.90%29.aspx

The default value is 30000000. which is 28.6mb. The correct way to set in web.config is -

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="1073741824">
      </requestLimits>
    </requestFiltering>
  </security>

</system.webServer>

This config cleared the error I was getting. I wish the errors reported were more descriptive, at least on local machines

Does this mean that setting <httpRuntime maxRequestLength="1048576" /> is enough for IIS 6 ? (the live server is win2003)

share | improve this answer
 

你可能感兴趣的:(handler)