tags:

views:

26

answers:

2

I'm able to manage FTP sites via the IIS manager, however, all attempts so far to manage the state of FTP sites using other means have failed, including:

  1. Using the IIS7 API (Microsoft.Web.Administration)
  2. Using WMI (with IIS6 compatibility enabled)
  3. Using the AppCmd tool in System32\inetsrv

Related questions:

Are there any workarounds I haven't tried? My objective is to manage (start/stop/query the state of) the FTP sites with C# code (as you can see from the 3 above attempted workarounds).

When querying the FTP server state using WMI, it returns code 4, which means "Stopped", even though the site is definitely shown as running in IIS manager.

AppCmd is useless, as it returns "Unknown" for FTP sites:

c:\Windows\System32\inetsrv>appcmd list site
SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Stopped)
SITE "Default FTP Site" (id:2,bindings:ftp/*:21:,state:Unknown)
A: 

To determine the state, you could just make a connection attempt.

To manage the state, I don't have any suggestions, I would've put my chips on WMI.

richardtallent
A: 

My workaround for managing the state is to set ServerAutoStart to false, and restart the ftpsvc Windows service. Thus far I have not found a way of detecting the state of a specific FTP server (IIS can have multiple FTP servers with different bindings).

nbolton