0

I have

   <system.web>
        <httpRuntime maxRequestLength="500000000"  />
    </system.web>

But when I read web.config via

 Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath);

            HttpRuntimeSection section =
              (HttpRuntimeSection)config.GetSection("system.web/httpRuntime"); 

I see 4096 value for maxRequestLength!!

How it could be?? Thanks for any clue!

P.S. It is ASP .NET MVC3 Razor project

NoWar
  • 36,338
  • 80
  • 323
  • 498
  • I had a similar issue that I never fully resolved, but some of the answers may be helpful in this case. See http://stackoverflow.com/questions/7536550/wcf-service-reference-support-files-not-updating – Eric J. Mar 24 '12 at 22:40
  • _"Theoretically, the maximum file upload size is fairly large. However, because of ASP.NET health monitoring, you cannot upload very large files in ASP.NET. The ASP.NET worker process has a virtual address space of 2 gigabytes (GB). However, the ASP.NET worker process only uses a little more than 1 GB because of health monitoring and memory fragmentation. "_ http://support.microsoft.com/kb/295626/en-us – Tim Schmelter Mar 24 '12 at 22:42

2 Answers2

1

There are a number of things to consider:

  • Is your <system.web> element a direct child of the <configuration> element?
  • Is your web.config file in the root of your IIS Application Scope root?
  • Is the <httpRuntime> element locked in the "root" .config file so values can't be overridden by other config files?

If you're using IIS then I recommend using the Configuration editor to investigate configuration precedence.

Dai
  • 141,631
  • 28
  • 261
  • 374
1

My guess is that 500,000,000 Kb is above the maximum value for the maxRequestLength property, so it's being assigned its default value (4,096). The documentation does not say what's the maximum value that maxRequestLength can take, but my guess is 20,97,151 Kb because that's roughly equal to 2^31 bytes, the maximum value that int can store.

Diego
  • 18,035
  • 5
  • 62
  • 66