/// <summary> /// Creates channel for RR endpoint /// </summary> private void SetUpController() { ChannelFactory <IRemoteRecorderController> channelFactory = new ChannelFactory <IRemoteRecorderController>( new NetNamedPipeBinding(), new EndpointAddress(Constants.ControllerEndpoint)); this.controller = channelFactory.CreateChannel(); }
/// <summary> /// Wait for the remote recorder service to start and creates channel for RR endpoint. /// </summary> private void SetUpController() { // Wait until RR service has started. Message every minute while waiting. while (true) { try { using (ServiceController serviceController = new ServiceController(RemoteRecorderServiceName)) { serviceController.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(60.0)); break; } } catch (System.TimeoutException) { Trace.TraceInformation("RemoteRecorderSync: Waiting for the recorder to start up."); } catch (InvalidOperationException) { // InvalidOperationException is not documented, but it is actually thrown immedately after the system boot. Trace.TraceInformation("RemoteRecorderSync: Service controller is not yet unavailable. Retry after 60 seconds."); Thread.Sleep(TimeSpan.FromSeconds(60.0)); } } // ServiceController.WaitForStatus() may return before the service has completely started, // so we have to give it a bit more time. Note that if this break isn't long enough, // we'll hit an exception later and return to HandleRRException again, so it's safe. Thread.Sleep(TimeSpan.FromSeconds(1.0)); ChannelFactory <IRemoteRecorderController> channelFactory = new ChannelFactory <IRemoteRecorderController>( new NetNamedPipeBinding(), new EndpointAddress(Panopto.RemoteRecorderAPI.V1.Constants.ControllerEndpoint)); this.controller = channelFactory.CreateChannel(); }
/// <summary> /// Wait for the remote recorder service to start and creates channel for RR endpoint. /// </summary> private void SetUpController() { // Wait until RR service has started. Message every minute while waiting. while (true) { try { using (ServiceController serviceController = new ServiceController(RemoteRecorderServiceName)) { serviceController.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(60.0)); break; } } catch (System.TimeoutException) { Trace.TraceInformation("RemoteRecorderSync: Waiting for the recorder to start up."); } catch (InvalidOperationException) { // InvalidOperationException is not documented, but it is actually thrown immedately after the system boot. Trace.TraceInformation("RemoteRecorderSync: Service controller is not yet unavailable. Retry after 60 seconds."); Thread.Sleep(TimeSpan.FromSeconds(60.0)); } } // ServiceController.WaitForStatus() may return before the service has completely started, // so we have to give it a bit more time. Note that if this break isn't long enough, // we'll hit an exception later and return to HandleRRException again, so it's safe. Thread.Sleep(TimeSpan.FromSeconds(1.0)); ChannelFactory<IRemoteRecorderController> channelFactory = new ChannelFactory<IRemoteRecorderController>( new NetNamedPipeBinding(), new EndpointAddress(Panopto.RemoteRecorderAPI.V1.Constants.ControllerEndpoint)); this.controller = channelFactory.CreateChannel(); }