static App() { DispatcherHelper.Initialize(); var serviceHost = new System.ServiceModel.Web.WebServiceHost(typeof(FluentAutomation.RemoteCommands.ServiceEndpoint), new Uri("http://localhost:10001/")); serviceHost.Open(); }
/// <summary> /// Start the HTTP Service /// </summary> /// <param name="NetTCPServiceHost"></param> public void StartHTTPService() { if (_HTTPserviceHost != null) { _HTTPserviceHost.Close(); } _HTTPserviceHost = null; _HTTPserviceHost = new System.ServiceModel.Web.WebServiceHost(typeof(wcfTeenService.wcf.TeenService)); _HTTPserviceHost.Open(); }
public void OpenHost() { try { //WebHttpBinding WebHttpBinding webBinding = new WebHttpBinding(); webBinding.MaxBufferPoolSize = int.MaxValue; webBinding.MaxReceivedMessageSize = int.MaxValue; webBinding.Security.Mode = WebHttpSecurityMode.None; webBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; //NetTcpBinding NetTcpBinding tcpBinding = new NetTcpBinding(); tcpBinding.MaxBufferPoolSize = int.MaxValue; tcpBinding.MaxReceivedMessageSize = int.MaxValue; tcpBinding.Security.Mode = SecurityMode.None; tcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.None; //ServiceBehavior ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); smb.HttpsGetEnabled = false; smb.HttpGetEnabled = true; _host.Description.Behaviors.Add(smb); ServiceDebugBehavior sdb = _host.Description.Behaviors.Find<ServiceDebugBehavior>(); sdb.HttpHelpPageEnabled = Globals.IsDebugMode; sdb.HttpsHelpPageEnabled = Globals.IsDebugMode; sdb.IncludeExceptionDetailInFaults = Globals.IsDebugMode; UseRequestHeadersForMetadataAddressBehavior urhfmab = new UseRequestHeadersForMetadataAddressBehavior(); _host.Description.Behaviors.Add(urhfmab); //MEX endpoint _host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "mex"); if (Globals.UseClientTcpHost && Globals.UseClientHttpHost) { _host.AddServiceEndpoint(typeof(IService), tcpBinding, _tcpBaseAddress); _host.AddServiceEndpoint(typeof(IService), webBinding, _httpBaseAddress); _host.Description.Endpoints[2].Contract = CopyContract(_host.Description.Endpoints[1].Contract); } else if (Globals.UseClientTcpHost) { _host.AddServiceEndpoint(typeof(IService), tcpBinding, _tcpBaseAddress); } else if (Globals.UseClientHttpHost) { _host.AddServiceEndpoint(typeof(IService), webBinding, _httpBaseAddress); _host.Description.Endpoints[1].Contract = CopyContract(_host.Description.Endpoints[1].Contract); } _host.Open(); IsOpen = true;
public void Start() { switch (_svc_hosts_type) { case ServiceHostType.soap: if (_soap_service_host != null) { _soap_service_host.Open(); } break; case ServiceHostType.web: if (_web_service_host != null) { _web_service_host.Open(); } break; } }