Start FTP

ServiceController mobServiceController4 = new System.ServiceProcess.ServiceController();

mobServiceController4.ServiceName = "MSFtpsvc";

if (mobServiceController4.Status == ServiceControllerStatus.Stopped)

{ try

 {

mobServiceController4.Start();

mobServiceController4.WaitForStatus(ServiceControllerStatus.Running);

MessageBox.Show("已经启动Internet信息服务默认FTP站点。", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

catch (Exception ex)

{

MessageBox.Show(ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

}

原文地址:https://www.cnblogs.com/greencolor/p/1787884.html