目錄
一、事故現場
在windows系統下安裝服務,cmd窗口執行如下命令:
"E:\work\_base\PsUm\PsUser\LdapWebServer\LdapWebServer.exe" install
報錯:
install service error: InstallAsEventCreate() failed: SYSTEM\CurrentControlSet\Services\EventLog\Application\PsLdapWebServer registry key already exists
二、分析
該問題的出現的原因在於,之前在該服務上成功安裝使用過該服務,然后使用sc delete命令卸載了,但是對應的registry注冊表中對應的信息沒有清除,因此我們在當前安裝服務的過程中就會出現因為無法將服務信息寫進注冊而導致安裝服務失敗!!!
三、解決方案
刪除注冊表相應的信息;
1、打開注冊表:WIN + R 輸入 regedit.exe
打開注冊表管理器:
2、從注冊表對應的路徑:“計算機\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\PsLdapWebServer\” 找到PsLdapWebServer相關內容,刪除即可;
3、再次install 服務,成功!
C:\WINDOWS\system32>"E:\work\_base\PsUm\PsUser\LdapWebServer\LdapWebServer.exe" install
Service "PsLdapWebServer" installed.