コード例 #1
0
        public static SafeServiceHost CreateServiceHost(VLogger logger, ModuleBase moduleBase, ISimplexDoorNotifierContract instance,
                                                        string address)
        {
            //SafeServiceHost service = new SafeServiceHost(logger, moduleBase, instance, address);

            SafeServiceHost service = new SafeServiceHost(logger, moduleBase, instance, address);

            //BasicHttpBinding binding = new BasicHttpBinding();

            var contract = ContractDescription.GetContract(typeof(ISimplexDoorNotifierContract));

            var webBinding  = new WebHttpBinding();
            var webEndPoint = new ServiceEndpoint(contract, webBinding, new EndpointAddress(service.BaseAddresses()[0]));

            webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior());

            service.AddServiceEndpoint(webEndPoint);

            service.AddServiceMetadataBehavior(new ServiceMetadataBehavior());

            //service.Description.Behaviors.Add(new ServiceMetadataBehavior());
            //service.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");

            return(service);
        }
コード例 #2
0
        public override SafeServiceHost Create()
        {
            var serviceHost = new SafeServiceHost(_proxy, new Uri("net.pipe://localhost/protonvpn-service"));

            serviceHost.AddServiceEndpoint(
                typeof(ISettingsContract),
                BuildNamedPipe(),
                "settings");

            serviceHost.Description.Behaviors.Add(new ErrorLoggingBehavior(_logger));

            return(serviceHost);
        }
コード例 #3
0
ファイル: AppLightSvc.cs プロジェクト: dhakalsamip/LoT
        public static SafeServiceHost CreateServiceHost(VLogger _logger, ModuleBase _moduleBase,
                                                        ISimplexLightNotifierContract _instance, string _address)
        {
            SafeServiceHost service     = new SafeServiceHost(_logger, _moduleBase, _instance, _address);
            var             contract    = ContractDescription.GetContract(typeof(ISimplexLightNotifierContract));
            var             webBinding  = new WebHttpBinding();
            var             webEndPoint = new ServiceEndpoint(contract, webBinding, new EndpointAddress(service.BaseAddresses()[0]));

            webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior());
            service.AddServiceEndpoint(webEndPoint);
            service.AddServiceMetadataBehavior(new ServiceMetadataBehavior());
            return(service);
        }
コード例 #4
0
        public static SafeServiceHost CreateServiceHost(VLogger logger, ModuleBase moduleBase, ISwitchSvcContract instance,
                                                        string address)
        {
            SafeServiceHost service = new SafeServiceHost(logger, moduleBase, instance, address);

            var contract = ContractDescription.GetContract(typeof(ISwitchSvcContract));

            var webBinding  = new WebHttpBinding();
            var webEndPoint = new ServiceEndpoint(contract, webBinding, new EndpointAddress(service.BaseAddresses()[0]));

            webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior());

            service.AddServiceEndpoint(webEndPoint);

            service.AddServiceMetadataBehavior(new ServiceMetadataBehavior());

            return(service);
        }
コード例 #5
0
ファイル: BluetoothScoutSvc.cs プロジェクト: RBSystems/LoT
        public BluetoothScoutService(string baseAddress, BluetoothScout btScout, ScoutViewOfPlatform platform, VLogger logger)
        {
            this.logger         = logger;
            this.bluetoothScout = btScout;

            service = new SafeServiceHost(logger, platform, this, baseAddress);

            var contract = ContractDescription.GetContract(typeof(IBluetoothScoutContract));

            var webBinding  = new WebHttpBinding();
            var webEndPoint = new ServiceEndpoint(contract, webBinding, new EndpointAddress(baseAddress));

            webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior());

            service.AddServiceEndpoint(webEndPoint);
            service.AddServiceMetadataBehavior(new ServiceMetadataBehavior());

            service.Open();
        }
コード例 #6
0
        public override SafeServiceHost Create()
        {
            var serviceHost = new SafeServiceHost(_proxy, new Uri("net.pipe://localhost/protonvpn-service"));

            serviceHost.AddServiceEndpoint(
                typeof(IVpnConnectionContract),
                BuildNamedPipe(),
                "connection");

            serviceHost.Description.Behaviors.Add(new ErrorLoggingBehavior(_logger));
            serviceHost.Description.Behaviors.Add(
                new ParameterValidatingBehavior(
                    new ValidatingParameterInspector(new List <IObjectValidator>
            {
                new ValidatableObjectValidator()
            })));

            return(serviceHost);
        }
コード例 #7
0
        public KinectScoutService(string baseAddress, KinectScout kinectScout, ScoutViewOfPlatform platform, VLogger logger)
        {
            this.logger      = logger;
            this.kinectScout = kinectScout;

            service = new SafeServiceHost(logger, platform, this, baseAddress);

            var contract = ContractDescription.GetContract(typeof(IKinectScoutContract));

            var webBinding  = new WebHttpBinding();
            var webEndPoint = new ServiceEndpoint(contract, webBinding, new EndpointAddress(baseAddress));

            webEndPoint.EndpointBehaviors.Add(new WebHttpBehavior());

            service.AddServiceEndpoint(webEndPoint);

            //service.Description.Behaviors.Add(new ServiceMetadataBehavior());
            //service.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
            service.AddServiceMetadataBehavior(new ServiceMetadataBehavior());

            service.Open();
        }