You must Sign In to post a response.
  • Category: .NET

    How to deploy windows service and install it in different machine?

    I have windows service in solution along with setup project when i install setup project from solution explorer it service appears in services pane. but now i want to install this service to another machine so how could i install this service in that machine? , Is only "setup1.msi" file is able to install and run whole service properly ?

    Give me some suggestions. Thanks.
  • #761958
    Hi Priyanka.

    Create a solution that contains your Windows Service project, then add a setup project
    to the solution to install the Window Service.

    Refer the below Microsoft article with source code.


    Sridhar Thota.
    If you learn't from defeat..
    You haven't really lost..

    Sridhar Thota.
    Editor: DNS Forum.

  • #761960
    Hai Priyanka,
    Yes, your setup should be able to install the windows service to individual systems. You need to install the setup to each of the system where you want to run the windows service as the Windows Service is dependent on the OS so it has to be installed to each individual systems.
    For creating the setup project for the windows service, you can follow the below article:

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #761970
    But in setup file everything is combined so if i want to change the database path in app configue file then how could I make it possible to change database path

  • #761971
    I got the answer that after installing setup in c:/program files there is folder created by setup file and there is config xml file where we can change database connection string but is it safe to change there ? or Is there any way to do the same safely?

  • #761990
    Hello Priyanka,

    You can create .ini (Configuration settings file) or secured notepad file (encrypted data)

    With using these type of files you can easily change the connection string according to your system.

    This will be more secured.

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762017
    @Nirav , Are you meant that making ini file of xml configuration file?

  • #762019
    Hello Priyanka,

    I mean ini configuration file not xml configuration file.

    xml configuration file is different from ini file. xml configuration contains tag and ini configuration file contains plain text so it will be more helpful and secured.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762022
    Ok , I got it will do surely.

  • #762363
    How to read data from ini file

  • #762386
    Hello Priyanka,

    As You can normally read data from text file :

    Sample data :

    string line;
    using (StreamReader reader = new StreamReader("samplefile.ini"))
    line = reader.ReadLine();

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • Sign In to post your comments