Top Shelf - starting directory when installed as service

83 views
Skip to first unread message

James Bradt

unread,
Nov 23, 2009, 10:41:47 AM11/23/09
to masstransit-discuss
Note to self...

Found this out the hard way when I couldn't figure out why my log4net
configuration wasn't loading properly.

When starting a top shelf application as a service, the current
directory is the system directory (C:\Windows\system32) instead of the
actual application directory.

So if your code is expecting to be running from a particular location,
it may have issues.

A normal suggestion is to have the following statement in the startup
logic for the service

System.IO.Directory.SetCurrentDirectory
(System.AppDomain.CurrentDomain.BaseDirectory);

(from http://haacked.com/archive/2004/06/29/706.aspx )


James

Dru Sellers

unread,
Nov 23, 2009, 10:54:46 AM11/23/09
to masstrans...@googlegroups.com
Sweet. THat's an easy add.
-d


--

You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=.



Dru Sellers

unread,
Nov 26, 2009, 6:38:45 AM11/26/09
to masstrans...@googlegroups.com
rev118 in trunk
Reply all
Reply to author
Forward
0 new messages