Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default Limits <limits> for IIS Express

I need to test a file upload component that will be accepting very large files. I want to test locally in my development environment but since I use IIS Express instead of IIS 7 I am not sure where to make the global change.

In IIS 7 the change cannot be made via the web.config but needs to be changed through the IIS Manager Tool. See this IIS article for an example.

Does anyone know how to make the same global change using IIS Express (in Visual Studio 2013)?

like image 617
webworm Avatar asked Jan 26 '15 17:01

webworm


People also ask

What is maximum allowed content length in IIS?

By default, IIS web server allows for limited file size to be uploaded to the web server. For IIS 6 and IIS 7, the default maximum file upload size is 4 MB and 28.6 MB respectively. IIS 7 returns a 404 error (HTTP Error 404.13 - CONTENT_LENGTH_TOO_LARGE) if someone uploads something larger than 30MB.

How many connections can IIS handle?

By default IIS 8.5 can handle 5000 concurrent requests as per MaxConcurrentRequestsPerCPU settings in aspnet. config. In machine. config, the maxconnection is 2 per CPU as default.

What is the difference between IIS and IIS Express?

An important difference is the way worker processes are managed. In IIS, the Windows Process Activation Service (WAS) silently activates and deactivates Web applications and the user has no direct control. In IIS Express, there is no WAS and the user has full control of application activation and deactivation.


2 Answers

If the web.config change ppascualv suggested doesn't work, try putting it in the IIS Express applicationhost.config, which can be found at

%userprofile%\my documents\iisexpress\config\applicationhost.config

under

<system.webServer>

put

<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="524288000"/>
    </requestFiltering>
</security>

This should set it as a global, unless a web.config from an application overrides it.

like image 152
Sarah Bailey Avatar answered Sep 18 '22 15:09

Sarah Bailey


You basically need to set both in web.config maxRequestLength and maxAllowedContentLength to upload files.

  • maxRequestLength Indicates the maximum file upload size supported by ASP.NET
  • maxAllowedContentLength This specifies the maximum length of content in a request supported by IIS.

Note:maxRequestLength is in kilobytes & maxAllowedContentLength is in Bytes

By default, Machine.config is configured to accept HTTP Requests upto 4096 KB (4 MB) and it is reflected in all your ASP.NET applications. You can change the Machine.config file directly, or you can change only the Web.config file of the application(s) you want to

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

 <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>
like image 22
Heisenberg Avatar answered Sep 20 '22 15:09

Heisenberg