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

问题描述 投票:0回答:2

我试图使用以下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
windows powershell iis windows-server-2016
2个回答
0
投票

尝试:

New-WebVirtualDirectory -Site "Default Web Site" -Name Wyse -PhysicalPath C:\inetpub\wwwroot

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

并从-name和-physicalpath中删除了引号,并在-site上使用了双引号,然后就可以了。我最初在尝试'IIS:\ Sites \ Default Web Site'。希望这可以帮助。


0
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.