Page 1 of 1

Uploading large digital goods file

Posted: Sat Dec 10, 2016 8:55 am
by mike92117
I have run into the 4MB issue in the past but simply updated my web.config to allow very large uploads for my digital goods. This has worked fine but I now have a 66 MB file that is failing about 45% into the upload. My largest file prior to this is around 7 MB.

This is my setting in my web.config:
<httpRuntime maxRequestLength="2147483647" executionTimeout="3600" requestValidationMode="2.0" targetFramework="4.5"/>

Any idea why this is happening? I have filled in both "File Name" and "Display Name" fields in the "Add Digital Good" dialog box.

Re: Uploading large digital goods file

Posted: Tue Dec 13, 2016 4:43 am
by mazhar
maxRequestLength value is given in Kilobytes. For 100MB set maxRequestLength to 100000

Re: Uploading large digital goods file

Posted: Tue Dec 13, 2016 5:52 am
by NC Software
It's been a long time since I setup my digital goods and I'm not using AC GOLD yet but I think I FTP'd all of my files into the App_Data/DigitalGoods folder (or whatever it's called) and then just referenced them from the digital goods config area.

Re: Uploading large digital goods file

Posted: Thu Dec 15, 2016 6:16 pm
by mike92117
In the time waiting for a response, I FTPd the file over to the server and then manually populated a new record in the ac_DigitalGoods table. That solved my immediate problem.

I did check and you are right about the max size is specified in KBs so I updated the web.config with the correct value. Note the value I used was based on a few different stackoverflow posts that incorrectly were using bytes, not kilobytes.

This is the line I used (for up to 200 MB):

Code: Select all

<httpRuntime maxRequestLength="200000" executionTimeout="3600" requestValidationMode="2.0" targetFramework="4.5"/>
I tried a new upload of the original 68 MB file and it sure appeared to upload but on completion I get a 404 error code and the file does not appear in App_Data/DigitalGoods folder nor does it show up in the db table. I tried several other files and it seems like anything above approx. 30 MB will fail with a 404.

Here is the solution:

With IIS 7, you need another value in your web.config (see this reference: https://weblogs.asp.net/pscott/404-erro ... -with-iis7):

Code: Select all

    <security>
       <requestFiltering><requestLimits maxAllowedContentLength="200000000" /></requestFiltering> 
	<!-- maxAllowedContentLength is in bytes. Defaults to 30,000,000 -->
    </security>
Warning: the maxRequestLength is in kilobytes. The maxAllowedContentLength is in bytes.

Further information is available at Microsoft: https://www.iis.net/configreference/sys ... uestlimits and I learned that:

The <requestLimits> element of the <requestFiltering> collection was introduced in IIS 7.0.
The exact http status is 404.13, Content Length Too Large because I was not setting it and it defaults to 30 MB when not set.

Hope this helps someone.