0

I am working on a project that involves a web application and two services. The two services each have their own job. One kills an entry in the application by marking it as dead in the database and removing it's "query string" from Splunk. The other is a reporting service. Every day at 5pm it sends out a report of all the active entries in the DB.

My issue is that these need to be installable on client servers and thus the IP address for the DB and the Splunk Server will be vary. Originally I was planning on encrypting the settings inside Settings.settings under the property folder. In the service's command line installation functions I tried putting Console.writeLine and readLine but after running that and doing some research I learned that Console output is discarded for services which leaves my settings empty.

What is the best practice to create an interface to configure a service?

Jaeg
  • 15
  • 3

2 Answers2

1

As any other .NET application the best way of configuring a service is via the app.config file. This file is renamed at compile time to yourappname.exe.config. You can the use the information contained with ConfigurationManager class. For password encryption, have a look at this other SO question: Encrypt password in App.config

Community
  • 1
  • 1
Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
  • I mean more about how do I go about creating an interface to configure the service. I can't just drop a password into app.config without getting it encrypted first. – Jaeg May 08 '14 at 14:01
  • @Jaeg: have you tried Googling for "app.config encryption"? – John Saunders May 08 '14 at 14:24
  • Yes, but that still would require an interface for the users to modify the config file which is the target of my question. – Jaeg May 08 '14 at 14:51
  • how to provide an UI does not belong to configutation itself, what you need to know about writing an UI? – Felice Pollano May 08 '14 at 15:00
  • Francis Ducharme answered my question. I didn't realize one program could modifying another's app.config. I'm going to write a program that'll change their app.config then have it automatically call them from cmd to install them. – Jaeg May 08 '14 at 15:10
0

You could add a simple Winform/WPF UI project to your solution and have it tweak/encrypt the service's .config file through SectionInformation.ProtectSection

It could be useful that it would ask the user if the service should be restarted when changes are done through the UI.

Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81