Click here to Skip to main content
13,143,693 members (29,319 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

11.1K views
8 bookmarked
Posted 4 Dec 2014

.NET Handling of Large Size Config File Issues

, 4 Dec 2014
Rate this:
Please Sign up or sign in to vote.
This is a very basic ASP.NET tip about how to manage multiple Config files on one web application by dividing the specific Config settings to multiple Config files.

Introduction

This is a very basic ASP.NET tip about how to manage multiple Config files on one web application by dividing the specific Config settings to multiple Config files.

Background

While developing the web application, a developer prefers to keep Configuration or setting parameters in Config file. The config file size can be too big due to more configuration sections like appSetings, configSections, connectionStrings, services related sections, logging sections, etc. In case of Enterprise Library Blocks, all of the configuration settings reside in .config file. This easily exceeds the config file default size limit of 250 KB. This throws the exception "Cannot read configuration file because it exceeds the maximum file size".

Solution

The solution for this issue is splitting of config file. Using this, we can specify certain sections of your web.config reside in a separate .config file. So you could have a connectionStrings.config file containing your connection strings or appSettings.config file for your appSettings section of web.config.

Below, we have Main Config file where we have mentioned the Config source to different configuration files.

ConnectionStrings.config

Appsettings.config

Points of Interest

  • Separate files can result in a more logical and modular structure for configuration files
  • Easy to manage
  • Settings in include file can be managed or changed at runtime without any impact

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Nilesh Morankar
Architect
India India
I have been working on Microsoft technologies for more than 9 years having technical experience on C#, ASP.NET, XML,Web Services, WCF MVP, Json, JQuery, MOSS, Ajax, Enterprise Library, SSRS, Sql Server 2005/2008.

Apart from complete SDLC, worked on Performance Optimization, Client Interaction, Environment Setup, Migration and Integration Work with SAP, EBI interfaces, DB Architecture

You may also be interested in...

Pro

Comments and Discussions

 
GeneralThank You ---- need more info Pin
Lakshmi Bhargav14-Dec-14 20:01
memberLakshmi Bhargav14-Dec-14 20:01 
GeneralMy vote of 3 Pin
Muni Kumar G4-Dec-14 23:04
professionalMuni Kumar G4-Dec-14 23:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170915.1 | Last Updated 4 Dec 2014
Article Copyright 2014 by Nilesh Morankar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid