使用Powershell在IIS中设置网站的应用程序池

Kas*_*sen 7 iis powershell application-pool

我需要一个Powershell命令,它相当于在IIS中添加一个网站,但是需要"应用程序池"的绑定:

在此输入图像描述

到目前为止,我可以添加一个这样做的网站:

New-Item iis:\Sites\swmarket -bindings @{protocol="http";bindingInformation="80:swmarket"} -physicalPath c:\inetpub\wwwroot
Run Code Online (Sandbox Code Playgroud)

但我不知道如何在新网站中设置"应用程序池".有什么方法可以看到所有的绑定吗?

D3v*_*r0n 9

Set-ItemProperty iis:\Sites\swmarket -Name applicationpool -Value swmarket
Run Code Online (Sandbox Code Playgroud)

或者,使用Powershell 3,您可以这样做:

New-WebAppPool -Name $WebSiteName
New-Website -Name $WebSiteName -ApplicationPool $WebSiteName -HostHeader $WebSiteName -PhysicalPath $PathInfo -Port 80
Set-Content $PathInfo\default.htm “PSCreated Default Page”
Run Code Online (Sandbox Code Playgroud)

在这里查看MS Technet描述.

  • 非常感谢你. (2认同)