如何使用Powershell将站点添加到我的IIS或IISExpress服务器

是否可以添加一个站点(和绑定)到IIS Express或IIS的applicationHost.config文件?

这里有一个我不得不手动添加(完美的作品)…

 <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>不存在)

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