开发者

cannot uninstall a windows service: "...cannot be deleted, because it's equal to the log name."

开发者 https://www.devze.com 2023-02-18 11:57 出处:网络
I need to uninstall a Win开发者_如何学JAVAdows Service I have created, but I get this error using the \"Uninstall or change program\" program in windows:

I need to uninstall a Win开发者_如何学JAVAdows Service I have created, but I get this error using the "Uninstall or change program" program in windows:

Error. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. -> The event log source '111 My Service' cannot be deleted, because it's equal to the log name.

Then I click "OK" and the program remains listed in the list of installed programs. What is worse, I cannot install a new version of it. The windows installer says that another version of this product is already installed and I should uninstall it first. How do I get rid of this program?

Update Here is what is happening when I run InstallUtil.exe /u command on it.

The uninstall is beginning. See the contents of the log file for the C:\MyService.MyService. assembly's progress. The file is located at C:\MyService.MyService.InstallLog. Uninstalling assembly 'C:\MyService.MyService.exe'. Affected parameters are: logtoconsole =

assemblypath = C:\MyService.exe

logfile = C:\MyService.MyService.InstallLog Removing EventLog source 111 My Service. An exception occurred during the uninstallation of the System.Diagnostics.EventLogInstaller installer. System.InvalidOperationException: The event log source '111 My Service' cannot be deleted, because it's equal to the log name. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalle l is complete.

The uninstall has completed. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalle l is complete.


Try to execute next command in cmd:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /u "c:\myservice.exe"

The second option is:

sc delete <service name>

After running the line above you can try to remove the service branch as well in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.


The accepted answer didn't work for me.

What worked is open regedit in administrator mode and find the service and delete it.


I had the exact same problem (and nothing in the selected answer worked).

Surprisingly, what fixed the problem was (using the standard "Uninstall or change program" or "Programs and Features" windows dialog) right-clicking on the program and choosing repair (this was apparently successful), and then uninstalling.


This just happened to me and the solution above didn't work where you run the InstallUtil.exe or delete the service. I had initially set up my service with the "LocalSystem" security context, and it was installed with that. I later changed the security context to "User" and recompiled the service executable and tried to uninstall the old service. The error messages were coming up that are described here, and once I went and changed the security context back to "LocalSystem" I could fully uninstall.

In other words, you might want to uninstall your old service with the executable it was created with rather than a newer one with possible modifications.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号