public override void Run() { Trace.TraceInformation("DragonMail.POPWorkerRole is running"); var endPoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["POPEndpoint"].IPEndpoint; var appInsights = new TelemetryClient(); var service = new POPService(); service.Run(e => appInsights.TrackException(e), endPoint); }
private async Task RunAsync(CancellationToken cancellationToken) { var appInsights = new TelemetryClient(); try { var endPoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["POPEndpoint"].IPEndpoint; var service = new POPService(); service.Run(e => appInsights.TrackException(e), endPoint); } catch (Exception x) { appInsights.TrackException(x); } // TODO: Replace the following with your own logic. while (!cancellationToken.IsCancellationRequested) { Trace.TraceInformation("Working"); await Task.Delay(1000); } }