当前位置: 首页 > 图文教程 > 操作系统 > Windows > 503 service unavailable错误说明

Windows
Windows7 用msinfo32查看版本号
系统技巧 制作闪存启动盘的思路
Windows7 不能打开.hlp文件问题解决
win7 以system帐户身份登录系统删除文件
Windows7 不能正常运行程序的解决方法
Windows7 快捷键大全 提高您的工作效率
安装Windows7 系统大硬盘分区方案
让你的windows7 系统更加完美的12种设置技巧
Windows7 系统应用Ghost软件注意事项
Windows7 新特性 Jump List
揭秘Win7 Vista下WinSXS超大文件夹.
Win7 判断自己的电脑是否被别人用过
Windows7 自动登录设置方法
Windows7 正版安装错误代码 0XC004F061
卸载双系统下面的Windows7的方法
解决Windows7 播放影音的锯齿问题
确保安全 Windows7十大禁忌服务
禁用Windows7的光盘刻录功能及去除快捷方式箭头
Windows7 无法删除文件的删除方法
Win7与winXP的双系统安装及Ghost注意事项

Windows 中的 503 service unavailable错误说明


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-16   浏览: 34 ::
收藏到网摘: n/a

每个AppPool要指定一个身份(identity)来运行。IIS6中AppPool默认运行身份为NT AUTHORITY\NETWORK SERVICE。这是一个系统内建帐户,完全受系统控制。它支持所有必要的以服务登录(Log on as a service)的权限,密码也是内部来维护——换句话说,我们可以把以服务登录理解为它可以控制了哪些帐户能够使用、操作远程资源。我们可以通过很多方法控制远程资源的访问。比如修改远程资源ACL表,并允许远端机器访问本地资源;或者在远程访问时换作远端授信帐户(impersonating)进行操作;或者索性让我们的程序运行在某一个配置帐户下——log on as a service。不同的是它是宿主在IIS的AppPool中的,必然收到IIS控制,用户本身没有办法像普通服务程序那样启动它。我要试验的就是指定AppPool以配置帐户启动。
  
  我们分几步来部署一个web程序以指定账户运行。
  1. 打开IIS6,在AppPool节点找到我们要修改的web程序,右键属性。
  默认IIS是选择Predefined帐户:Network Service。现在我们勾选Configurable,并指定帐户和密码。注意:这个帐号必须是一个域帐号!
  2. 将我们之前指定的apppool帐号加入IIS_WPG用户组中。IIS_WPG用户组维护了所有可以以其中帐户启动worker Process的帐户。Worker Process是由IIS启动的。
  
  做完这两步,本以为可以完美的开启自定义帐户运行的w3wp.exe。却不想得到"Service Unavailable”的异常。翻看event log,我们得到以下一些错误:
  错误一:此错误基本就是重复一下Service Unavailable的意思。。。注意主谓关系:有某某后台要启动某个process来运行appPool。这个process肯定就是w3wp.exe。但那个后台是谁?这里还不知道。
  
  Event Type: Error
  Event Source: W3SVC
  Event Category: None
  Event ID: 1059
  Date: 1/18/2008
  Time: 11:48:27 AM
  User: N/A
  Computer: HITOMI
  Description:
  A failure was encountered while launching the process serving application pool 'HITOMIWS'. The application pool has been disabled.
  
  For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
  错误二:已经告诉我们所指定的appPool帐户非法。另外一个极重要的提示回答了error一的疑惑:是World Wide Web Publishing Service无法启动w3wp.exe。(这里也回答了文章最初的问题)至此,唯一的问题就是为什么帐户非法?往下看。。。
  
  Event Type: Warning
  Event Source: W3SVC
  Event Category: None
  Event ID: 1057
  Date: 1/18/2008
  Time: 11:48:27 AM
  User: N/A
  Computer: HITOMI
  Description:
  The identity of application pool 'HITOMIWS' is invalid, so the World Wide Web Publishing Service can not create a worker process to serve the application pool. Therefore, the application pool has been disabled.
  
  For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
  
  错误三:谜底揭晓了。该账户没有被赋予logontype4,导致它非法。如果有经验的话,这种帐户-logonType控制是在local Security Settings\Local Policy\User Rights Assignments里定义的。具体来说就是log on as a service。
  
  Event Type: Failure Audit
  Event Source: Security
  Event Category: Logon/Logoff
  Event ID: 534
  Date: 1/18/2008
  Time: 11:48:08 AM
  User: NT AUTHORITY\SYSTEM
  Computer: HITOMI
  Description:
  Logon Failure:
   Reason: The user has not been granted the requested
   logon type at this machine
   User Name: HITOMIWEBSERVICE
   Domain: REDMOND
   Logon Type: 4
   Logon Process: Advapi
   Authentication Package: Negotiate
   Workstation Name: HITOMI
   Caller User Name: HITOMI$
   Caller Domain: REDMOND
   Caller Logon ID: (0x0,0x3E7)
   Caller Process ID: 640
   Transited Services: -
   Source Network Address: -
   Source Port: -
  
  For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
  Start > Run, secpol.msc回车, 打开local Secuirty Settings,展开Local Policy\User Rights Assignments,选择Log on as a service这个policy,果然里面有NetworkService和sql server的n多帐户,我们再把appPool帐户加到这个list里面。做完之后,machine需要重新启动。等一切再次ready以后,我们再试一下web程序,欣喜看到w3wp.exe已经以指定帐号启动了!
  回头再考虑一下我们什么时候要用指定帐户运行web程序呢?It depends。当我们的web 程序要经常访问域内其他节点资源的时候,为提高访问安全要用到指定帐户,加强ACL控制。其实在大多数情况下NetworkService已经可以够用了。