Topshelf program:
public class Program { public static void Main(string[] args) { HostFactory.Run(hostConfigurator => { hostConfigurator.UseLog4Net("..\\..\\App.config"); hostConfigurator.Service<bird>(serviceConfigurator => { serviceConfigurator.ConstructUsing(name => new Bird()); serviceConfigurator.WhenStarted(nm => nm.Start()); }); }); } } public class Bird { public void Start() { HostLogger.Get<bird>().Info("Chirp, chirp!"); } }
App.config:
why isnt the app.config visible
ReplyDeleteYou shouldn't be loading the app.config directly, you should be using the file that gets copied to the output directory, it will be named something like "[myprogram].exe.config".
ReplyDelete