I was tripped up by the fact that our web.config file has multiple system.web sections: it worked when I added < httpRuntime maxRequestLength="1048576" /> to the system.web section that at the configuration level.
It bothered me for days too.
I modified the Web.config file but it didn't work.
It turned out that there are two Web.config file in my project,
and I should modified the one in the ROOT directory, not the others.
Hope this would be helpful.
If you are using IIS for hosting your application, then the default upload file size if 4MB. To increase it, please use this below section in your web.config -
maxRequestLength (length in KB) Here as ex. I took 1024 (1MB) maxAllowedContentLength (length in Bytes) should be same as your maxRequestLength (1048576 bytes = 1MB).
If you have a request going to an application in the site, make sure you set maxRequestLength in the root web.config. The maxRequestLength in the applications's web.config appears to be ignored.
I was tripped up by the fact that our web.config file has multiple system.web sections: it worked when I added < httpRuntime maxRequestLength="1048576" /> to the system.web section that at the configuration level.
It bothered me for days too. I modified the Web.config file but it didn't work. It turned out that there are two Web.config file in my project, and I should modified the one in the ROOT directory, not the others. Hope this would be helpful.
It may be worth noting that you may want to limit this change to the URL you expect to be used for the upload rather then your entire site.
If you are using IIS for hosting your application, then the default upload file size if 4MB. To increase it, please use this below section in your web.config -
For IIS7 and above, you also need to add the lines below:
Note:
maxRequestLength
is measured in kilobytesmaxAllowedContentLength
is measured in byteswhich is why the values differ in this config example. (Both are equivalent to 1 GB)
maxRequestLength (length in KB) Here as ex. I took 1024 (1MB) maxAllowedContentLength (length in Bytes) should be same as your maxRequestLength (1048576 bytes = 1MB).
If you have a request going to an application in the site, make sure you set maxRequestLength in the root web.config. The maxRequestLength in the applications's web.config appears to be ignored.