在 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 命令