Пример #1
0
        protected override void OnAfterStart()
        {
            try
            {
                _address = Constants.BaseAddress + Pid;

                var binding = WcfUtils.GetNetNamedPipeBinding();

                var ep = new EndpointAddress(_address);

                var type             = typeof(IRemoteVstService);
                var proxyCreatorType = MakeGenericType(type);
                var proxyCreator     = GetProxyCreator(proxyCreatorType, binding, ep);
                var x = _generator.CreateInterfaceProxyWithoutTarget(type, new[] { typeof(IContextChannel) },
                                                                     CreateInterceptor(proxyCreator, type));

                _vstService = x as IRemoteVstService;


                _vstService.Ping();
                _vstServiceAvailable = true;
                IsBusy = false;
                _pingTimer.Start();
            }
            catch (Exception ex)
            {
                ForceStop($"Failure when attempting to open the service channel: {ex}");
            }
        }