Windows services and their configuration files

Saturday, 16 June 2007 01:44 by Myself

I discovered that reading app.config from a windows service can be quite tricky. It’s all about naming and, I might need to add, the sufficient rights. The default name of the app.config is {assemblyName.exe}.config.

Eg) MyService.exe.config.

All is good this far, but let's say you deploy the application and want to change a value by editing the xml. You might end up with no change, because when the runtime engine fails to find the config file it defaults to the value from the time of compilation.

If the service is running under “Local System”, the config file should be

{assemblyName.exe}.local.config

Or it might also be (but the one above has >priority)

{assemblyName}.config. (note that the file extension is stripped)

I ran SysInternals FileMon during the start to find this out, a real handy tool that can shed some light on the most peculiar problem.


Knowing this hopefully saves you some time.

I’ve straightened out all of my problems for now, and my Windows Service is successfully hosting a WCF endpoint and the debugging works!

I finally uninstalled Visual Studio 2005, since Orcas demands monopoly, and I don’t regret it… Yet. Time for some WPF!

Tags:   ,
Categories:   Development
Actions:   E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

January 6. 2009 01:39

 
Software