Search code examples
asp.netweb-configcustom-sections

Additional sections in ASP.NET web.config file error


I have legacy ASP.NET web site, upgraded from ASP.NET 2.0 to ASP.NET 4.0 target framework. It's a pity, but the old web.config file uses too many custom sections, positioned on the same level as appSettings.

Web site compiles with error "Unrecognized configuration section MyCustomSection". Is it possible not to refactor all the code and keep the custom config sections in the web.config file?


Solution

  • Have you added the MyCustomSection to the configsections?

    <configSections>
    <section name="MyCustomSection"... />
    </configSections>