在 Windows Server 2008 上使用 %windir%\system32\inetsrv\appcmd.exe list wp 命令,獲得以下錯誤:app
ERROR ( message:WAS 服務不可用 - 請先嚐試啓動該服務。 )post
ERROR ( message:The WAS service is not available - try starting the service first. ).net
但執行 sc query was 與 sc query w3svc 發現這兩個服務的狀態都是 running。blog
轉而嘗試執行 appcmd list site 或者 appcmd list site 都會獲得以下錯誤:進程
ERROR ( message:配置錯誤
文件名: redirection.config
行號: 0
描述: 因爲權限不足而沒法讀取配置文件
。 )ip
ERROR ( message:Configuration error
Filename: redirection.config
Line Number: 0
Description: Cannot read configuration file due to insufficient permissions
. )ci
看來又是權限問題,原來此時本身用的並非管理員帳號,appcmd 許多命令都須要提高爲管理員權限才能執行,所以運行 runas /user:administrator cmd 從新打開一個 cmd,再次執行 appcmd list wp,OK,當前正在運行的應用程序池列出來了!get
相關參考:cmd
AppCMD "ERROR ( message:The WAS service is not available - try starting the service first.)"
Listing Running Web Applications Using Iisapp.vbs (IIS 6.0)
來自:http://blogs.leoworks.net/feng/post.aspx?post=iis7-appcmd-list-wp-The-WAS-service-is-not-available
附:win7 也相似 須要以管理員身份運行 cmd 命令