public ServerProxy(string serverUri, ICredentials credentials) { IsAuthorized = true; var uriString = serverUri; if (!serverUri.EndsWith("dsf")) { uriString = serverUri + (serverUri.EndsWith("/") ? "" : "/") + "dsf"; } AppServerUri = new Uri(uriString); WebServerUri = new Uri(uriString.Replace("/dsf", "")); Credentials = credentials; try { HubConnection = new HubConnectionWrapper(uriString) { Credentials = credentials };; HubConnection.Error += OnHubConnectionError; HubConnection.Closed += HubConnectionOnClosed; HubConnection.StateChanged += HubConnectionStateChanged; //HubConnection.TraceLevel = TraceLevels.All; //HubConnection.TraceWriter = new Dev2LoggingTextWriter(); InitializeEsbProxy(); } catch (Exception err) { HubConnection = new Dev2.SignalR.Wrappers.Old.HubConnectionWrapperOld(uriString) { Credentials = credentials };; HubConnection.Error += OnHubConnectionError; HubConnection.Closed += HubConnectionOnClosed; HubConnection.StateChanged += HubConnectionStateChanged; //HubConnection.TraceLevel = TraceLevels.All; //HubConnection.TraceWriter = new Dev2LoggingTextWriter(); InitializeEsbProxy(); } }
public ServerProxy(string serverUri, ICredentials credentials) { IsAuthorized = true; var uriString = serverUri; if (!serverUri.EndsWith("dsf")) { uriString = serverUri + (serverUri.EndsWith("/") ? "" : "/") + "dsf"; } AppServerUri = new Uri(uriString); WebServerUri = new Uri(uriString.Replace("/dsf", "")); Credentials = credentials; try { HubConnection = new HubConnectionWrapper(uriString) { Credentials = credentials }; ; HubConnection.Error += OnHubConnectionError; HubConnection.Closed += HubConnectionOnClosed; HubConnection.StateChanged += HubConnectionStateChanged; //HubConnection.TraceLevel = TraceLevels.All; //HubConnection.TraceWriter = new Dev2LoggingTextWriter(); InitializeEsbProxy(); } catch(Exception err) { HubConnection = new Dev2.SignalR.Wrappers.Old.HubConnectionWrapperOld(uriString) { Credentials = credentials }; ; HubConnection.Error += OnHubConnectionError; HubConnection.Closed += HubConnectionOnClosed; HubConnection.StateChanged += HubConnectionStateChanged; //HubConnection.TraceLevel = TraceLevels.All; //HubConnection.TraceWriter = new Dev2LoggingTextWriter(); InitializeEsbProxy(); } }
public void Connect(Guid id) { ID = id; try { if (!IsLocalHost) { if (HubConnection.State == ConnectionStateWrapped.Reconnecting) { HubConnection.Stop(new TimeSpan(0, 0, 0, 1)); } } if (HubConnection.State == ConnectionStateWrapped.Disconnected) { ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; try { if (!HubConnection.Start().Wait(5000)) { if (!IsLocalHost) { ConnectionRetry(); } } } catch (AggregateException aex) { HubConnection = new Dev2.SignalR.Wrappers.Old.HubConnectionWrapperOld(AppServerUri.ToString()) { Credentials = Credentials };; HubConnection.Error += OnHubConnectionError; HubConnection.Closed += HubConnectionOnClosed; HubConnection.StateChanged += HubConnectionStateChanged; //HubConnection.TraceLevel = TraceLevels.All; //HubConnection.TraceWriter = new Dev2LoggingTextWriter(); InitializeEsbProxy(); if (!HubConnection.Start().Wait(5000)) { if (!IsLocalHost) { ConnectionRetry(); } } } } } catch (AggregateException aex) { aex.Flatten(); aex.Handle(ex => { var hex = ex as HttpClientExceptionWrapped; if (hex != null) { switch (hex.Response.StatusCode) { case HttpStatusCode.Unauthorized: case HttpStatusCode.Forbidden: UpdateIsAuthorized(false); throw new UnauthorizedAccessException(); } } var hexOld = ex as Dev2.SignalR.Wrappers.New.HttpClientExceptionWrappedOld; if (hexOld != null) { switch (hexOld.Response.StatusCode) { case HttpStatusCode.Unauthorized: case HttpStatusCode.Forbidden: UpdateIsAuthorized(false); throw new UnauthorizedAccessException(); } } throw new Exception(); }); } catch (Exception) { throw; } }
public void Connect(Guid id) { ID = id; try { if (!IsLocalHost) { if (HubConnection.State == ConnectionStateWrapped.Reconnecting) { HubConnection.Stop(new TimeSpan(0, 0, 0, 1)); } } if (HubConnection.State == ConnectionStateWrapped.Disconnected) { ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; try { if (!HubConnection.Start().Wait(5000)) { if (!IsLocalHost) { ConnectionRetry(); } } } catch (AggregateException aex) { HubConnection = new Dev2.SignalR.Wrappers.Old.HubConnectionWrapperOld(AppServerUri.ToString()) { Credentials = Credentials }; ; HubConnection.Error += OnHubConnectionError; HubConnection.Closed += HubConnectionOnClosed; HubConnection.StateChanged += HubConnectionStateChanged; //HubConnection.TraceLevel = TraceLevels.All; //HubConnection.TraceWriter = new Dev2LoggingTextWriter(); InitializeEsbProxy(); if (!HubConnection.Start().Wait(5000)) { if (!IsLocalHost) { ConnectionRetry(); } } } } } catch (AggregateException aex) { aex.Flatten(); aex.Handle(ex => { var hex = ex as HttpClientExceptionWrapped; if (hex != null) { switch (hex.Response.StatusCode) { case HttpStatusCode.Unauthorized: case HttpStatusCode.Forbidden: UpdateIsAuthorized(false); throw new UnauthorizedAccessException(); } } var hexOld = ex as Dev2.SignalR.Wrappers.New.HttpClientExceptionWrappedOld; if (hexOld != null) { switch (hexOld.Response.StatusCode) { case HttpStatusCode.Unauthorized: case HttpStatusCode.Forbidden: UpdateIsAuthorized(false); throw new UnauthorizedAccessException(); } } throw new Exception(); }); } catch (Exception) { throw; } }