locked
Windows Service installation issues - Windows 7 RRS feed

  • Question

  • I created a simple windows service which I cannot get to install manually by using VS.NET's cmd prompt with the IntallUtil /i command so I created a setup project.  I was able to install my Local Service using that approach but I am not not able to see it in Administrative Tools/Services.

    I don't understand why I can't see this service when it has been installed properly.  I tried refreshing, uninstalling and reinstalling, etc.

    Please help....

    Monday, July 25, 2011 7:53 PM

Answers

  • What does C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\MyNewService\MyNewService\bin\Debug\MyNewService.InstallLog contain?

    Also, are you executing InstallUtil.exe from an elevated command line?

    • click Start button
    • type cmd.exe in the search box
    • when found right-click it and select "Run as administrator"
    • accept the elevation request
    • execute your InstallUtil command line

    Cosmin Pirvu
    • Proposed as answer by Jie Bao Wednesday, July 27, 2011 8:35 AM
    • Marked as answer by Jie Bao Tuesday, October 18, 2011 2:29 AM
    Tuesday, July 26, 2011 8:52 PM
  • Windows and Vista are UAC systems. You may be running into a privilege issue. You will not be running with true admin privilege unless you run from an elevated prompt.  Note that your log says you have a security access issue.
    Phil Wilson
    • Proposed as answer by Jie Bao Wednesday, July 27, 2011 8:35 AM
    • Marked as answer by Jie Bao Tuesday, October 18, 2011 2:29 AM
    Tuesday, July 26, 2011 10:56 PM

All replies

  • Hi Brian,

    Not sure if you have read the documents form MSDN about installation for Windows Service:

    Special the second link, please follow it and there is an article explain it in details: http://www.codeproject.com/KB/cs/DynWinServiceInstallUtil.aspx

     

    For troubleshooting the installation of the Windows Service, please refer to this document, nad if it is possible, you could share the log here: http://msdn.microsoft.com/en-us/library/s0h9wb98.aspx (view the log by command Installutil.exe /LogFile=[filename] : http://msdn.microsoft.com/en-us/library/50614e95.aspx)

     

    Sincerely,

     


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Proposed as answer by Cosmin Pirvu Tuesday, July 26, 2011 6:20 AM
    • Edited by Jie Bao Wednesday, July 27, 2011 8:23 AM
    Tuesday, July 26, 2011 5:00 AM
  • Yes, I have installed Windows Services before.  I am only having problems with Windows 7.

    Any help would be appreciated.

    I was hoping to get a response that would point me in the correct direction, not assume I didn't know anything....this is why I said I was able to install the Windows Service using an installation project.

    The problem I am having IS seeing the installed Service in the Services panel of Administrative Tools specifically with Windows 7.


    Tuesday, July 26, 2011 12:34 PM
  • You didn't say that this happens only on Windows 7 and it works on other Windows versions. Also, if you don't offer details about your problem you shouldn't expect fast solutions or assume an user who reads your post will guess your exact scenario or level of expertise.

    From the Windows Installer point of view, services are simple:

    • If it's not a native service, it's not installed (for example it was a normal application that was converted to a service by some kind of third party tool). In this case you first need to find out how you can install your service manually and then try to use a custom action to replicate it.
    • If it's not shown in Services applet, it was not installed. It doesn't matter what your installation did or if its EXE was copied in the instalation folder. If it's not displayed then it doesn't exist as a service.

    As a general rule of thumb, if you can't do it manually, it won't work when performed by an installer. Also, if InstallUtil cannot install your service most likely it's not a valid service or it's not supported by Windows 7.

    If you can install your service manually on other Windows versions, post the InstallUtil output from Windows 7 so we can take a look. If you cannot install the service on any Windows version, you need to find out what's wrong with it.


    Cosmin Pirvu
    Tuesday, July 26, 2011 7:18 PM
  • Cosmin - the title of thread says Windows 7 so I'm not sure how I need to be more clear....

    Here is what my installLog shows...

    Uninstalling assembly 'C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\MyNewService\MyNewService\bin\Debug\MyNewService.exe'.
    Affected parameters are:
       logtoconsole =
       logfile = C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\MyNewService\MyNewService\bin\Debug\MyNewService.InstallLog
       assemblypath = C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\MyNewService\MyNewService\bin\Debug\MyNewService.exe
    Removing EventLog source MyNewService.
    An exception occurred during the uninstallation of the System.Diagnostics.EventLogInstaller installer.
    System.Security.SecurityException: Requested registry access is not allowed.
    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.

    Why would this work differently on Windows 7 vs. Vista, etc....

    Tuesday, July 26, 2011 8:09 PM
  • What does C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\MyNewService\MyNewService\bin\Debug\MyNewService.InstallLog contain?

    Also, are you executing InstallUtil.exe from an elevated command line?

    • click Start button
    • type cmd.exe in the search box
    • when found right-click it and select "Run as administrator"
    • accept the elevation request
    • execute your InstallUtil command line

    Cosmin Pirvu
    • Proposed as answer by Jie Bao Wednesday, July 27, 2011 8:35 AM
    • Marked as answer by Jie Bao Tuesday, October 18, 2011 2:29 AM
    Tuesday, July 26, 2011 8:52 PM
  • Windows and Vista are UAC systems. You may be running into a privilege issue. You will not be running with true admin privilege unless you run from an elevated prompt.  Note that your log says you have a security access issue.
    Phil Wilson
    • Proposed as answer by Jie Bao Wednesday, July 27, 2011 8:35 AM
    • Marked as answer by Jie Bao Tuesday, October 18, 2011 2:29 AM
    Tuesday, July 26, 2011 10:56 PM
  • From your log, yes, it is a security access issue. Please try to run your Command Prompt as admin and then check the log again. and if it has the problem still, show the log here again, we will help you.

    Thanks.


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, July 27, 2011 8:38 AM
  • Bob here are the results after executing the same InstallUtil /i WindowService command with a brand new Windows Service with elevated UAC for cmd.

     

    Running a transacted installation.

    Beginning the Install phase of the installation.
    See the contents of the log file for the C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\WindowsService\WindowsService\bin\Debug\WindowsService.exe assembly's progress.
    The file is located at C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\WindowsService\WindowsService\bin\Debug\WindowsService.InstallLog.

    An exception occurred during the Install phase.
    System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.

    The Rollback phase of the installation is beginning.
    See the contents of the log file for the C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\WindowsService\WindowsService\bin\Debug\WindowsService.exe assembly's progress.
    The file is located at C:\Users\bevans.DPDOM\Documents\Visual Studio 2010\Projects\WindowsService\WindowsService\bin\Debug\WindowsService.InstallLog.

    The Rollback phase completed successfully.

    The transacted install has completed.

    Monday, August 1, 2011 4:42 PM
  • Well, one suggestion, could you please check your current can run this service account? Or you designed this service run in Network Service or Local Service.

    Please try to add your current user group into Network Service or Local Service. For example, your current user group is Administrators, please open Control Panel > User Accounts > Change accoutn type. Select the Advanced tab and click "Advanced" button. open the console of Local Users and Groups. (or you could run the command "lusrmgr.msc" in Start Menu > Run) 

    Right click on the Administrators group, select "Add to Group.." and Add the Local Service or Network Service into this group then run your install command again. Please use Advanced.. > Find Now to find the both account in your system.

    Or please try to give the Network Service/Local Service read permission on the EventLog/Security key, Start Menu > Run > Regedit > find HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security, right click on it and select Permission... to add Local Service or Network Service read permission.

     

    Sincerely,

     

     


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, August 2, 2011 5:21 PM
  • hi Cosmin Pirvu,

     

    Thanks for posting, it work for me..

    Tuesday, August 23, 2011 9:56 AM
  • thanks.its very useful. solved my problem.
    Monday, October 17, 2011 11:35 AM