IIS 新建虚拟目录。获取"Parent node has no children of type virtualDirectory"错误



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

PS C:UsersAdministrator> New-WebVirtualDirectory -name 'sy' -site 'sy site' -PhysicalPath 'C:Projectsbuoy'
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

我在网站(例如"默认网站"(时看到了此错误。

如果您使用的是其他站点名称,请确保它在IIS中的"站点"节点下存在于Web服务器上。这就是您的错误所指的"父节点"。

尝试:

New-WebVirtualDirectory -Site "Default Web Site" -Name Wyse -PhysicalPath C:inetpubwwwroot

去了:https://learn.microsoft.com/en-us/powershell/module/webadminstration/new-webvirtualdirectory?view=winserver2012-ps

并从-NAME和-Physical Pather中删除了引号,并使用了 - 点上的双引号,然后使用。我最初是在尝试-Site'IIS: sites 默认网站'。希望这会有所帮助。

相关内容

最新更新