IIS FTP powershell 站点创建失败并出现管道错误

IIS FTP powershell 站点创建失败并出现管道错误

当我运行以下行时,Power shell 在New-WebFtpSite命令上抛出管道已停止异常。

dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-FTPServer
New-WebFtpSite -Name 'Default Ftp Site' -Port '21'

我似乎无法解决异常。有没有更好的方法在 Windows 7 powershell 上设置 FTP 服务器?

答案1

首先使用命令/c在第一个 dism 命令之前切换。请参阅这个帖子(最底部的倒数第二条评论)以获得比当前使用的格式更好的命令。

然后,使用此命令创建 FTP 站点:

New-WebFtpSite -Name testFtpSite -Port 21 -PhysicalPath c:\test -HostHeader mySite -IPAddress 127.0.0.1

答案2

启用该功能IIS-FTPSvc以及其他已启用的功能解决了我的问题。

最终命令如下所示,不需要 cmd /c 内容:

dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-FTPServer /featurename:IIS-FTPSvc

相关内容