Yauhen Pyl
2011-11-30 13:49:25 UTC
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?
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?