i need uploading files on site , have following web.config (huge values done test purpose now):
<?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <sectiongroup name="system.web.webpages.razor" type="system.web.webpages.razor.configuration.razorwebsectiongroup, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> <section name="host" type="system.web.webpages.razor.configuration.hostsection, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> <section name="pages" type="system.web.webpages.razor.configuration.razorpagessection, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> </sectiongroup> </configsections> <system.web> <httpruntime maxrequestlength="2000000000" executiontimeout="9999999" /> </system.web> <system.web.webpages.razor> <host factorytype="system.web.mvc.mvcwebrazorhostfactory, system.web.mvc, version=5.2.2.0, culture=neutral, publickeytoken=31bf3856ad364e35" /> <pages pagebasetype="system.web.mvc.webviewpage"> <namespaces> <add namespace="system.web.mvc" /> <add namespace="system.web.mvc.ajax" /> <add namespace="system.web.mvc.html" /> <add namespace="system.web.optimization" /> <add namespace="system.web.routing" /> <add namespace="website" /> <add namespace="react.web.mvc" /></namespaces> </pages> </system.web.webpages.razor> <appsettings> <add key="webpages:enabled" value="false" /> </appsettings> <system.webserver> <handlers> <remove name="blockviewhandler" /> <add name="blockviewhandler" path="*" verb="*" precondition="integratedmode" type="system.web.httpnotfoundhandler" /> </handlers> <validation validateintegratedmodeconfiguration="false"/> <modules runallmanagedmodulesforallrequests="true"/> <security> <requestfiltering> <requestlimits maxallowedcontentlength="400000000"/> </requestfiltering> </security> </system.webserver> </configuration>
the problem still can't upload several files. looks when try upload files total size in 4mb error exceeding max request limit. have ideas how find out reason of this? i've spent lot of time without results , bit confused.
you need have max request length in httpruntime in main web.config file, not 1 in views.
e.g. 16mb
<system.web> <compilation debug="true" targetframework="4.5.2"/> <httpruntime targetframework="4.5.2" maxrequestlength="16777216"/> <httpmodules> <add name="applicationinsightswebtracking" type="microsoft.applicationinsights.web.applicationinsightshttpmodule, microsoft.ai.web"/> </httpmodules>