I have a simple class which sets up NserviceBus for a legacy windows service. This configuration is called when the service starts up. When I run the application as a console app the configuration in the App.config is picked up, however when running the application as a windows service the App.config configuration isn't picked up. Is there any way I can specify the app config location? (as I have done with the log4net.config).
namespace MossSapUploadInterface
{
public static class BootStrapper
{
public static void Init()
{
var config = AppDomain.CurrentDomain.BaseDirectory + "log4net.config";
XmlConfigurator.Configure(new FileInfo(config));
var log = LogManager.GetLogger(typeof(BootStrapper));
ObjectFactory.Initialize(x => x.AddRegistry<MessageServiceRegistry>());
ObjectFactory.Configure(x => x.For<ILog>().TheDefault.Is.Object(log));
var bus = Configure.With()
.StructureMapBuilder(ObjectFactory.Container)
.MsmqTransport()
.IsTransactional(true)
.UnicastBus()
.ImpersonateSender(false)
.XmlSerializer()
.CreateBus()
.Start();
SetLoggingLibrary.Log4Net();
}
}
}