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:
- Open registry editor – Start > Run > regedit.exe.
- Navigate to key: HKLM\SOFTWARE\Microsoft\InetStp\Configuration (If there is no ‘Configuration’ key, create it)
- 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:
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