Discussion:
Microsoft.Web.Administration and COMException (0x80070032): The request is not supported
(too old to reply)
Yauhen Pyl
2011-11-30 13:49:25 UTC
Permalink
Simple console application:

private static void Main(string[] args)
{
using (ServerManager serverManager = new ServerManager())
{
Configuration appHostConfiguration = serverManager.GetApplicationHostConfiguration();

ConfigurationSection logDefinitionsSection = appHostConfiguration.GetSection("system.webServer/advancedLogging/server", "Default Web Site/api");

ConfigurationElementCollection logDefinitionsCollection = logDefinitionsSection.GetCollection("logDefinitions");
logDefinitionsCollection.Clear();

serverManager.CommitChanges();
}
}

This code throw exception:

Unhandled Exception: System.Runtime.InteropServices.COMException: The request is not supported. (Exception from HRESULT: 0x80070032)
at Microsoft.Web.Administration.Interop.IAppHostElementCollection.Clear()
at Microsoft.Web.Administration.ConfigurationElementCollectionBase`1.Clear()
at ConsoleApplication1.Program.Main(String[] args) in D:\TestWebAdministaration\TestWebAdministaration\Program.cs:line 16

Please help! I need to set some rights or what?
Yauhen Pyl
2011-12-02 10:58:58 UTC
Permalink
Hm, seems like applicationHost.config is just blocked for editing by
Microsoft.Web.Administration (nodes that marked overrideModeDefault="Deny"). So I edited it by System.IO.
Loading...