Using the following C# code:
using System;
using Microsoft.Web.Administration;
namespace getftpstate
{
class Program
{
static void Main(string[] args)
{
ServerManager manager = new ServerManager();
foreach (Site site in manager.Sites)
{
Console.WriteLine("name: " + site.Name);
Console.WriteLine("state: " + site.State);
Console.WriteLine("----");
}
}
}
}
I get the following output:
C:\projects\testiisftp\getftpstate\getftpstate\bin\Debug>getftpstate.exe
name: Default Web Site
state: Stopped
----
name: Default FTP Site
Unhandled Exception: System.Runtime.InteropServices.COMException (0x800710D8): T
he object identifier does not represent a valid object. (Exception from HRESULT:
0x800710D8)
at Microsoft.Web.Administration.Interop.IAppHostProperty.get_Value()
at Microsoft.Web.Administration.ConfigurationElement.GetPropertyValue(IAppHos
tProperty property)
at Microsoft.Web.Administration.Site.get_State()
at getftpstate.Program.Main(String[] args) in C:\projects\testiisftp\getftpst
ate\getftpstate\Program.cs:line 17
Any ideas why I might be seeing the above 0x800710D8 COM error? I'm able to manage the FTP site just fine using IIS manager (I can start, stop, change settings, etc).