如何使用 PowerShell 在 IIS 中停止和启动单个网站? [英] How can I stop and start individual websites in IIS using PowerShell?
本文介绍了如何使用 PowerShell 在 IIS 中停止和启动单个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Windows 7 开发机器上的 IIS7 中配置了多个站点以在同一端口上运行,并且通常一次只运行一个站点,具体取决于我正在处理的内容.我希望能够从 PowerShell 启动和停止我的开发站点,而不是打开 IIS 管理器.有没有人有很好的资源来为我指明正确的方向,或者有一个已经完成这个任务的脚本?
I have multiple sites configured in IIS7 on my Windows 7 development machine to run on the same port and usually only run one at a time depending on what I'm working on. I would like to be able to start and stop my development sites from PowerShell instead of having the IIS manager opened. Does anyone have a good resource to point me in the right direction or a script that already accomplishes this?
推荐答案
仅供日后快速参考,命令为:
Just for future quick reference, the commands are:
Import-Module WebAdministration
Stop-WebSite 'Default Web Site'
Start-WebSite 'Default Web Site'
这篇关于如何使用 PowerShell 在 IIS 中停止和启动单个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文