Set maximum allowed file size in IIS6

Vote:
 

I have a file upload control on a page. It works fine as long as the file being uploaded is below ~4-5Mb in size.

If a file above that is uploaded bad things happen.

The browser tells me the connection was aborted/lost/broken.

The request isn't reaching my code and no response is returned from the server.

I believe it could be some constraint on IIS6 that is causing this. I've tried setting the maxRequestLength in web.config but it doesn't help.

If anyone else have any ideas I'd welcome them greatly!

#75073
Sep 17, 2013 9:55
Vote:
 

For IIS6 maximum allowed request length is 4096 in KB, which is about 4MB. By changing httpRuntime -> maxRequestLength should do the trick. More info: http://support.microsoft.com/default.aspx?scid=kb;EN-US;295626

 

Can you post fragment from web.confg?

#75098
Sep 17, 2013 19:18
Vote:
 

<system.web>
<httpHandlers>
<clear />
<!-- This section is copied from root web.config -->
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
<add path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true" />
<add path="*.ashx" verb="*" type="System.Web.UI.SimpleHandlerFactory" validate="true" />
<add path="*.asmx" verb="*" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
<add path="*.ascx" verb="*" type="System.Web.HttpForbiddenHandler" validate="true" />
<add path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" validate="true" />
</httpHandlers>
<httpRuntime maxRequestLength="20480" executionTimeout="1200" />
<pages>
<controls>
<add tagPrefix="EPiServerUI" namespace="EPiServer.UI.WebControls" assembly="EPiServer.UI" />
<add tagPrefix="EPiServerScript" namespace="EPiServer.ClientScript.WebControls" assembly="EPiServer" />
<add tagPrefix="EPiServerScript" namespace="EPiServer.UI.ClientScript.WebControls" assembly="EPiServer.UI" />
</controls>
</pages>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<authorization>
<allow roles="WebEditors, WebAdmins, Administrators,StimAdmin,Kung" />
<deny users="*" />
</authorization>
</system.web>
</location>
<location path="UI/edit/CMS/admin">
<system.web>
<authorization>
<allow roles="WebAdmins, Administrators, StimAdmin,Kung" />
<deny users="*" />
</authorization>
</system.web>
</location>
<!-- Uncomment the following section in order to enable Office integration on the application. -->
<!--<location path="UI/OfficeIntegration">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>-->
<location path="WebServices">
<!--
Configure the EPiServer.Security.BasicAuthentication module to send a basic authentication challenge
instead of a redirect to the forms login page. For this to take effect the EPiServer.Security.BasicAuthentication
module must be added to the list of http modules.
-->
<episerver.basicAuthentication sendBasicChallenge="true" basicRealm="" />
<system.web>
<httpRuntime maxRequestLength="20480" executionTimeout="1200" />
<authorization>
<allow roles="WebServices,Administrators" />
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="util">
<system.web>
<pages>
<controls>
<add tagPrefix="EPiServerUI" namespace="EPiServer.UI.WebControls" assembly="EPiServer.UI" />
<add tagPrefix="EPiServerScript" namespace="EPiServer.ClientScript.WebControls" assembly="EPiServer" />
</controls>
</pages>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<httpHandlers>
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
<add path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true" />
<add path="*.ashx" verb="*" type="System.Web.UI.SimpleHandlerFactory" validate="true" />
<add path="*.asmx" verb="*" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
<add path="*" verb="*" type="EPiServer.Web.StaticFileHandler, EPiServer" validate="true" />
</httpHandlers>
</system.web>

#75113
Sep 18, 2013 9:03
Vote:
 

I've managed to get a server response now but it doesn't matter how high I set the length, it still fails.

Trying to send a form with some text values and a 6,67Mb file with a file uploader in the form

causes a "Maximum request length exceeded" server error after the upload reaches 86%.

#75163
Sep 19, 2013 9:14
Vote:
 

This seems familiar. Could it be that you need to configure both maxRequestLength (under <httpRuntime>) and a matching maxAllowedContentLength (under <system.webServer>) ?

See http://www.codeproject.com/Tips/72592/IIS-7-needs-extra-configuration-to-allow-large-fil

#75259
Sep 23, 2013 22:06
Vote:
 

This is for IIS6, it does not have system.webServer elements - http://www.iis.net/configreference/system.webserver.

Anything interesting if you enable every possible logging available? :)

#75260
Sep 23, 2013 22:10
Vote:
 

The solution was pretty simple...

I needed to add <httpRuntime maxRequestLength="20480" executionTimeout="1200" /> in the very first <system.web> section in web.config and not in any location specific section.

#75261
Sep 23, 2013 22:16
Vote:
 

Great success :), however you do have <httpRuntime> with maximum length in first system.web in fragment you posted. Therefore I tried to "look" for other cases. Anyway great that you solved.

#75263
Sep 23, 2013 22:24
Vote:
 

I see that. What isn't clear is that it's from within a location specific section. Poor copy/paste, maybe it would have been clearer otherwise. =/

#75267
Sep 23, 2013 23:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.