[英]How to update "physical path" of a site on IIS 10 using Powershell?
When creating a site I manage to set the path with the following line of code创建站点时,我设法使用以下代码行设置路径
New-WebSite -Name "mysite" -port 8084 -PhysicalPath "c:\inetpub\wwwroot" -ApplicationPool "myappPool"
I have tried to figure out how to update the path, nothing found via Configuration Editor.我试图弄清楚如何更新路径,但通过配置编辑器找不到任何东西。 I thought I had it with the following command
我以为我用下面的命令
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/sites/site[@name='mysite']/virtualDirectoryDefaults" -name "physicalPath" -value "c:\inetpub\wwwroot\mysite"
...but, it is not virtualdirectory I want to update, but the actual site... ...但是,我要更新的不是虚拟目录,而是实际站点...
You could use below PowerShell command to change the iis site physical path.您可以使用下面的 PowerShell 命令来更改 iis 站点的物理路径。
run PowerShell as administrator.以管理员身份运行 PowerShell。
run below command:运行以下命令:
PS C:\WINDOWS\system32> Import-Module WebAdministration
PS C:\WINDOWS\system32> Set-ItemProperty IIS:\Sites\sitea -name physicalPath -value "D:\s1"
after changing the path open iis manager and refresh the site.更改路径后打开 iis 管理器并刷新站点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.