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:
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)
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).
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.