Upgrading Sitecore caused your web.config to exceed the maximum file size? Here is how you fix it

Recently I have been working on a Sitecore upgrade and after I was done upgrading it and tried to load Sitecore I got the following error:

“Cannot read configuration file because it exceeds the maximum file size”

I did some research and found this very useful link with the steps to fix this:

  1. Open registry editor – Start > Run > regedit.exe.
  2. Navigate to key:  HKLM\SOFTWARE\Microsoft\InetStp\Configuration (If there is no ‘Configuration’ key, create it)
  3. Add/change DWORD value MaxWebConfigFileSizeInKB. The default value is 250 KB. Each SIP domain requires about 3 KB for rewrite rules, so the new value should be not less than 3 * (expected count of SIP domains). In my case I set the value to 700. This is how it should look like:

post1

4. Run “iisreset” command in CMD to apply the new restriction value.

After I reset my IIS Sitecore started working again.

If you don’t want to change the max size of the web.config there is one other thing you can do as suggested by @jammykam and @dschmpsv which is split the configuration file into multiple ones. For example if you are using the IIS URL Rewrite module, by default it will update your web.config files. You can in this case set all your rewrite rules into a single config file and reference it on the web.config. With this approach you also reduce the size it. Hopefully this will be usefull for anyone working with upgrades in the future!

To check this post in portuguese click here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s