I try to create instance of ServerManager (Microsoft.Web.Administration.dll) to get IIS Web Applications list. Code is running on the Windows 2008 Server, ASP.NET, IIS7. IIS located on the same machine. But on this line
var serverManager = new ServerManager();
I get exception:
System.ArgumentNullException: Value cannot be null. Parameter name: type
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Microsoft.Web.Administration.ConfigurationManager..ctor(ServerManager owner, String applicationHostConfigurationPath)
at Microsoft.Web.Administration.ServerManager..ctor(String applicationHostConfigurationPath)
What can I do?