Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Service Config File C#

People also ask

What is a service config file?

The service configuration file is an XML file that is used to register the service on the cluster, configure service behavior, and customize how the broker interacts with the service. For example, broker behavior such as monitoring, message throttling, and load balancing can be defined at the individual service level.

Where are Windows config files stored?

This file is located in %windir%\system32\inetsrv\config.

What is app config file in C#?

App. Config is an XML file that is used as a configuration file for your application. In other words, you store inside it any setting that you may want to change without having to change code (and recompiling). It is often used to store connection strings.


I located the error and it was related to file permissions. After installing the service, my local user account didn't have access to modify the app.exe.config file.

The tool I was using to edit was not informing me it was being denied access to save the file - that's notepad++ if anyone is interested - so I couldn't see that it wasn't saving over the old config file.

Solved now, thanks everyone.

Martin.


When you are in debug mode check and see what settings are in the my_exe_file_name.vshost.exe.config Also make sure you adjust this in the app.config file. Visual studio should update the final config file in your bin/debug folders.


Maybe you are updating the wrong config file. You should double check that using

System.Configuration.ConfigurationManager.OpenExeConfiguration(PATH_TO_CONFIG);

Generally for the Windows Services that I write, i drop the appName.exe.config file into C:\WINDOWS\system32\

Perhaps you have an older version in that directory, which is where your service is getting the value, even though you've updated the config file in your project.


App.config file should be renamed to your_exe_file_name.exe.config and placed near the exe file.