public override void Run() { Trace.TraceInformation("ViagogoWatcher.WorkerRole is running"); IClockTimer clockTimer = ClockTimerBuilder.Build(); clockTimer.Watch(); //try //{ // this.RunAsync(this.cancellationTokenSource.Token).Wait(); //} //finally //{ // this.runCompleteEvent.Set(); //} }
static void Main(string[] args) { HostFactory.Run(x => { x.Service <IClockTimer>(s => { s.ConstructUsing(name => ClockTimerBuilder.Build()); s.WhenStarted(tc => tc.Watch()); s.WhenStopped(tc => tc.Stop()); }); x.RunAsLocalSystem(); x.SetDescription("ViagogoWatcher"); x.SetDisplayName("ViagogoWatcher"); x.SetServiceName("ViagogoWatcher"); }); }