![如何使用 Powershell 将站点添加到我的 IIS 或 IISExpress 服务器](https://linux22.com/image/647438/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20Powershell%20%E5%B0%86%E7%AB%99%E7%82%B9%E6%B7%BB%E5%8A%A0%E5%88%B0%E6%88%91%E7%9A%84%20IIS%20%E6%88%96%20IISExpress%20%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
是否可以将站点(和绑定)添加到applicationHost.config
IIS Express 或 IIS 文件中?
这是我必须手动添加的一个(效果很好)...
<site name="Our Awesome website" id="4">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\XWing\Code\Application\Website" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:1200:localhost" />
<binding protocol="http" bindingInformation="*:80:localhost.www.mywebsite.com.au" />
<binding protocol="https" bindingInformation="*:44302:localhost.www.mywebsite.com.au" />
<binding protocol="http" bindingInformation="*:80:localhost.www.mywebsite2.com" />
<binding protocol="https" bindingInformation="*:44302:localhost.www.mywebsite2.com" />
/>
<site>..</site>
这可能吗?(我假设不是存在)
答案1
New-Website 和 New-WebBinding[2] 小程序应该可以执行您所要求的操作。
1:http://technet.microsoft.com/en-us/library/ee790605.aspx
2:http://technet.microsoft.com/en-us/library/ee790567.aspx