Web config size limit exceeded under IIS7 0x80070032

8

I have a web.config file which is quite large in my current solution running on IIS7.

It's working perfect on my dev server however I encounter the error 0x80070032 "Config Error Cannot read configuration file because it exceeds the maximum file size"

My current solution uses a very large web.config file. The architecture of my CMS application requires a large number of configuration settings.

Is there some way to extend this size limit or can I split the web.config file down into smaller files?

.net
asp.net
iis-7
web-config
asked on Stack Overflow Oct 19, 2010 by user325558 • edited Oct 20, 2010 by Kev

2 Answers

16

Have you tried adding this registry key:

HKLM\SOFTWARE\Microsoft\InetStp\Configuration

Then set this DWORD value: MaxWebConfigFileSizeInKB

If your system is running 64 bit windows but your application pool is running in 32-bit mode then you may need to set this in:

HKLM\SOFTWARE\Wow6232Node\Microsoft\InetStp\Configuration

If your web.config file is oversized because of a large number of rewrite rules then you could separate these into their own files:

Storing URL rewrite mappings in a separate file

answered on Stack Overflow Oct 20, 2010 by Kev
6

Is your CMS solution Sitecore? If so, Sitecore has two options for splitting its config out of the main web.config file.

Sitecore supports using the <sc:include> tag to include a part of the configuration from a seperate file. You just put the <sc:include> tag wherever the configuration would go:

<sitecore database="SqlServer">
    <sc.include file="C:\Program Files\SitecoreSampleSite\sitecore.config"/>
</sitecore>

Then you start the configuration at the parent of <sc:include> (in this case sitecore) in the include file:

<sitecore database="SqlServer">
    <sc.variable name="dataFolder" value="/data"/>
    <sc.variable name="mediaFolder" value="/upload"/>
    <sc.variable name="tempFolder" value="/temp"/>
    ...
</sitecore>

Sitecore themselves use this in their standard configuration so you can see quite a few examples of this just by looking for in their standard configuration file.

Your other option is to pull out some configuration and put it into the app_config/includes directory. At runtime Sitecore will look for any .config files in there and then add any configuration in the file to the main config.

This configuration file needs to have the full Sitecore configuration structure.

answered on Stack Overflow Jun 10, 2011 by Helephant

User contributions licensed under CC BY-SA 3.0