« Previous Next »

Thread: Programatic install of managed module: "...missing a section declaration"

Last post 10-23-2009 9:14 AM by anilr. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 10-23-2009, 9:04 AM

    • cjb3bhl
    • Not Ranked
    • Joined on 09-11-2009, 4:28 PM
    • Posts 6

    Programatic install of managed module: "...missing a section declaration"

    I am trying to programtically install a managed module that I wrote into IIS 7.0 on a Windows 2008 Server 32-bit system.  I get the following error:

    Unhandled Exception: System.Runtime.InteropServices.COMException (0x80070490): Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
    Error: The configuration section 'system.webserver/modules' cannot be read because it is missing a section declaration.

    The code is as follows:

    ServerManager mgr = new ServerManager();

    Microsoft.Web.Administration.Configuration config;

    Microsoft.Web.Administration.ConfigurationSection section;

    Microsoft.Web.Administration.ConfigurationElementCollection modules;

    Microsoft.Web.Administration.ConfigurationElement tapModule;

    config = mgr.GetApplicationHostConfiguration();section = config.GetSection("system.webserver/modules");

    modules = section.GetCollection();

    It is the config.GetSection() call that is generating the exception.  What am I doing wrong here?  I have not touched the applicationHost.config file, so why would it be invalid?

  • 10-23-2009, 9:14 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Programatic install of managed module: "...missing a section declaration"

    The S in webServer needs to be upper-case.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (2 items)
Microsoft Communities