public static SafeServiceHost CreateServiceHost(VLogger logger, ModuleBase moduleBase, ISimplexRelaySwitchNotifierContract instance, string address) { SafeServiceHost service = new SafeServiceHost(logger, moduleBase, instance, address); var contract = ContractDescription.GetContract(typeof(ISimplexRelaySwitchNotifierContract)); 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); }
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); }