Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Service Fails to start whenever I have code inside it to access app.config using configuration manager

$
0
0

Hello,

I have coded a windows service. It runs, starts, stops or works fine. But I am using hard coded configurable values in the code, which is not a good practice. I would rather use the App.config file. Except, I am unable to. Whenever I modify the App.config, for example as shown below..

<configuration>

  <appSettings>

    <addkey="production"value="y"/>

  </appSettings>

and then in my source code files try to access the configuration setting, for example with code

if (ConfigurationManager.AppSettings["production"] == "y")

my service fails to start. It gives me the following error message, when I try to start it..

"Windows could not start the <ServiceNameHere< service on Local Computer

Error 1053: The service did not respond to the start or control request in a timely fashion."

Please note I am able to compile & install the service (using installutil command), just fine. The problem is that it never starts.

Help Appreciated. thank you


diana4


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>