IIS 新的虚拟目录。获取“父节点没有 virtualDirectory 类型的子节点”。错误

Red*_*Fox 4 windows iis powershell windows-server-2016

我正在尝试使用以下 powershell 命令将我的 Web 项目文件夹添加到 IIS 作为虚拟目录,但出现错误。想知道我是否错过了什么。谢谢。

PS C:\Users\Administrator> New-WebVirtualDirectory -name 'sy' -site 'sy site' -PhysicalPath 'C:\Projects\buoy'
New-WebVirtualDirectory : Parent node has no children of type virtualDirectory.
Parameter name: path
At line:1 char:1
+ New-WebVirtualDirectory -name 'sy' -site 'sy site' -PhysicalPath 'C:\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-WebVirtualDirectory], ArgumentException
    + FullyQualifiedErrorId : Parent node has no children of type virtualDirectory.
Parameter name: path,Microsoft.IIs.PowerShell.Provider.NewVirtualDirectoryCommand
Run Code Online (Sandbox Code Playgroud)

Pau*_*aul 5

当网站(例如“默认网站”)不存在时,我看到此错误。

如果您使用不同的站点名称,请确保该名称存在于 IIS 中“站点”节点下的 Web 服务器上。这就是您的错误所指的“父节点”。