Powershell-通过Web界面调用时,新网站cmdlet不起作用

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

我希望有人可以为我提供以下帮助:

我已经创建了一个脚本来基于现有站点安装网站。该脚本执行几个步骤-复制目录,还原数据库,创建网站和应用程序池等。它可以通过Powershell CLI在Administrator帐户下正常运行。我为此脚本创建了一个WinForms前端,该前端引用了Powershell,并且也很好地执行了该脚本。现在,我想为其创建一个Web前端。 (如此处说明:http://devinfra-us.blogspot.com/2011/02/using-powershell-20-from-aspnet-part-1.html)但是,我无法通过网络前端使用“新网站” cmdlet。脚本中的所有其他步骤都可以正常工作,包括“ new-WebappPool”(我可以在IIS管理器中看到新的appPool)。我没有任何错误。我已确保脚本以管理员权限运行(此时,安全性是[[not关注的问题])以下是Powershell脚本的输出:

********************** Windows PowerShell transcript start Start time: 20200106164117 Username: NNN-WEB\adminArr <-- Adminstrator account RunAs User: NNN-WEB\adminArr Machine: NNN-WEB (Microsoft Windows NT 10.0.14393.0) Host Application: c:\windows\system32\inetsrv\w3wp.exe -ap DefaultAppPool -v v4.0 -l webengine4.dll -a \\.\pipe\iisipmd4bdced8-d455-428b-b9ef-8b3e2bfb38dd -h C:\inetpub\temp\apppools\DefaultAppPool\DefaultAppPool.config -w -m 0 -t 20 -ta 0 Process ID: 8448 PSVersion: 5.1.14393.3383 PSEdition: Desktop PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14393.3383 BuildVersion: 10.0.14393.3383 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1
windows powershell iis
1个回答
0
投票
您可以使用以下PowerShell命令在iis中创建站点:

Import-Module WebAdministration New-WebAppPool NewAppPool New-Website -Name "mike" -Port 8086 -PhysicalPath c:\casp -ApplicationPool NewAppPool

enter image description here

enter image description here

运行命令后不要忘记刷新iis。

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