Pregunta

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?

¿Fue útil?

Solución 2

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.

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top