0

I have written a windows service that references a library written by another colleague. The library uses an app.config file and has three values in its section. I've added the same settings to the of my service but when the library reads them they are empty. The service itself has its own values in the same section and they are read fine. When installing the service I put its .EXE file, the library .DLL and the config file in one folder and then use installUtil.exe to install the service. What am I missing? Why doesn't the library see the configuration?

Thanks in advance.

  • Could you add the code for the two app.config files? You can change the names of any sensitive items, but without seeing them it's difficult to diagnose any issues. – Matthew Jaspers Mar 25 '15 at 15:50
  • maybe this [question](http://stackoverflow.com/questions/3255820/apply-an-app-config-to-my-dll-assembly) will help you come up with some ideas. – pnm Mar 25 '15 at 15:58
  • I'm not sure how it helps but here is the content of the section of the config file. Bottom three are for the library, top one is read fine by the service – Martin Rousev Mar 25 '15 at 16:00

1 Answers1

0

To answer my own question here's what happened. The config file was opened in Visual Studio and it was locked. The windows service was not failing because it was reading an older version of the file prior to opening it in Visual Studio. This old version had the first key/value pair from but not the rest. That is why only the service was seeing its values and not the library. After closing Visual Studio everything works. It only took me a day to figure it out.