Ramblings about development and woodworking


Solutions to the MaxWebConfigSizeInKB error

Posted on in Development by Kyle Heon

No Comments
Praesent dictum diam

Last week while assisting a customer with a Sitecore upgrade we ran into an error that I'd never seen before (the customer however had). The error was related to the size of the Web.config file exceeding the max size limit (which is by default set to 250kb).

I would imagine that this is a rather edge case scenario but I wanted to point out a few options you have to combat this error should you run into it. The first option is to increase the max size limit by making the following registry hack. While this is definitely a quick win I would argue that it isn't a recommended practice.

The second, which is what I'd consider a recommended practice, would be to reduce the size of your Web.config by moving configuration to external configuration files using .NET's built-in configSource attribute just like Sitecore does with it's connectionStrings node, as detailed below:

<connectionStrings configSource="App_Config\ConnectionStrings.config" />

By moving configuration out of the Web.config you not only shrink the overall size of the Web.config file but you also make it easier to isolate application configuration. Additionally, if you are developing with Sitecore you make it easier to handle future upgrades as your configuration elements are [mostly] separated from Sitecore.

Another recommended practice here is to use external files that end in .config as IIS will not serve those files if browsed to directly. Some additonal reading on this topic can be found here and here.

Hopefully this helps someone. If you agree or disagree with my approach by all means, let me know in the comments below.

comments powered by Disqus



Dust Collected was founded in 2014 by Kyle Heon and is a play on a series of words that have meaning in both software engineering and woodworking.