/// <summary> /// Connect the client to a RPC endpoint. /// </summary> /// <param name="endpoint">The endpoint for RPC server.</param> /// <param name="security_quality_of_service">The security quality of service for the connection.</param> public void Connect(RpcEndpoint endpoint, SecurityQualityOfService security_quality_of_service) { if (Connected) { throw new InvalidOperationException("RPC client is already connected."); } if (endpoint == null) { throw new ArgumentNullException("Must specify an endpoint", nameof(endpoint)); } try { _transport = RpcClientTransportFactory.ConnectEndpoint(endpoint, security_quality_of_service); _transport.Bind(InterfaceId, InterfaceVersion, NdrNativeUtils.DCE_TransferSyntax, new Version(2, 0)); } catch { // Disconnect transport on any exception. _transport?.Disconnect(); _transport = null; throw; } }
private RpcServerProcessInformation GetServerProcessInformation() { using (var transport = RpcClientTransportFactory.ConnectEndpoint(this, new RpcTransportSecurity() { AuthenticationLevel = RpcAuthenticationLevel.None })) { return(transport.ServerProcess); } }