Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web config size limit exceeded under IIS7 0x80070032

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?

like image 897
user325558 Avatar asked Oct 19 '10 21:10

user325558


2 Answers

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

like image 195
Kev Avatar answered Sep 18 '22 07:09

Kev


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.

like image 36
Helephant Avatar answered Sep 19 '22 07:09

Helephant