none
How to configure window service display name in .net?

    Question

  • How can i chanage the windows service display name without rebuilding solution??Means can i put windows service name in app.config??

     

    Best Regards,

    Navin Tiwari

     

    Wednesday, October 20, 2010 2:56 PM

Answers

  • The AppSettings portion of your app.config file just allows you to have certain global variables defined within your application that you can change without having to actually recompile the code. You cannot change the display name in this file, though. The name of the service, once it has been installed, can only be changed through the registry. If you feel comfortable doing this, then you can:

    - Login as an Administrator
    - Open REGEDIT
    - Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services and locate the service you wish to change. Hint: If you don't know the Service Name, search for the current Display Name.
    - In the right-hand pane double-click the DisplayName String value and edit it to the new name.
    - Reboot the system.

    The above was found at (http://www.techbytes.ca/techbyte73.html)

    However, I would STRONGLY recommend that you don't go messing around the registry unless you absolutely need to.  The best approach would be to go in and change the display name of the service within your actual service's deployment project.


    Ankit
    • Marked as answer by Bin-ze Zhao Tuesday, October 26, 2010 7:00 AM
    Thursday, October 21, 2010 1:04 PM

All replies

  • How can i change windows service display name from app config with rebuilding the soultion???

     

    Best Regards,

    Navin Tiwari


    Navin
    • Merged by Bin-ze Zhao Tuesday, October 26, 2010 7:01 AM duplicated
    Wednesday, October 20, 2010 3:08 PM
  • Navin,

    Not sure how you are deploying your windows service, but you can't change the name of the windows service without changing how it has been deployed. There are settings located in the Setup and Deployment project where you can change the Application Name.


    Ankit
    Wednesday, October 20, 2010 3:10 PM
  • Hi Ankit,

     

    I am deploying windows service using installutill.exe.Can i chamge the windows service display name from app config??

     

    Best Regards,

    Navin Tiwari


    Navin
    Wednesday, October 20, 2010 3:14 PM
  • As far as I know, the name of the service is retrieved from the assembly information. You can deploy your windows service by adding a setup and deployment project to your solution which will generate a .msi file for your windows service to be deployed on any server you wish. Its a bit more scalable than using the installutil.exe command.
    Ankit
    Wednesday, October 20, 2010 7:45 PM
  • There is any code snippet by which i can configure the windows serivice name in app config file as below.

     

    CofigurationManager.AppSetting["Poller"];

    After rebuilding it is to be installed on a m/c.Now  i want to use the same build dlls code on the other machine with diiff name.For this what can i do just to change windows service display neme in app config file only.

    If above is possible then no need to rebulid the solution every time just to change service display name.

    Do you have any code or sample ??

     

     

     


    Navin
    Thursday, October 21, 2010 12:35 PM
  • The AppSettings portion of your app.config file just allows you to have certain global variables defined within your application that you can change without having to actually recompile the code. You cannot change the display name in this file, though. The name of the service, once it has been installed, can only be changed through the registry. If you feel comfortable doing this, then you can:

    - Login as an Administrator
    - Open REGEDIT
    - Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services and locate the service you wish to change. Hint: If you don't know the Service Name, search for the current Display Name.
    - In the right-hand pane double-click the DisplayName String value and edit it to the new name.
    - Reboot the system.

    The above was found at (http://www.techbytes.ca/techbyte73.html)

    However, I would STRONGLY recommend that you don't go messing around the registry unless you absolutely need to.  The best approach would be to go in and change the display name of the service within your actual service's deployment project.


    Ankit
    • Marked as answer by Bin-ze Zhao Tuesday, October 26, 2010 7:00 AM
    Thursday, October 21, 2010 1:04 PM
  • Hello,

    You can change the name of the service from the service installer like so:

          this.serviceInstaller1.ServiceName = "ServiceName";
          this.serviceInstaller1.DisplayName = "DisplayName";
    
    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Friday, October 22, 2010 9:38 PM
  • Hello,

    If you are using an installer, you can change the name of the service from the service installer like so:

          this.serviceInstaller1.ServiceName = "ServiceName";
          this.serviceInstaller1.DisplayName = "DisplayName";
    
    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Friday, October 22, 2010 9:45 PM