private void _load_web_host() { Uri _web_http_url = new Uri( System.Configuration.ConfigurationManager.AppSettings["Web_HTTP_Url"]); _web_service_host = new System.ServiceModel.Web.WebServiceHost(wcf_service, _web_http_url); //Añadimos endpoint web System.ServiceModel.Description.ServiceEndpoint epoint = _web_service_host.AddServiceEndpoint(_service_interface, new System.ServiceModel.WebHttpBinding(), _web_http_url); //Vamos a añadir la carateristica de autoformato en response System.ServiceModel.Description.WebHttpBehavior wbhttp = epoint.Behaviors.Find <System.ServiceModel.Description.WebHttpBehavior>(); if (wbhttp != null) { wbhttp.AutomaticFormatSelectionEnabled = true; wbhttp.HelpEnabled = true; } else { wbhttp = new System.ServiceModel.Description.WebHttpBehavior(); wbhttp.AutomaticFormatSelectionEnabled = true; wbhttp.HelpEnabled = true; wbhttp.FaultExceptionEnabled = true; epoint.Behaviors.Add(wbhttp); } }
public void StopHTTPService() { if (_HTTPserviceHost != null) { _HTTPserviceHost.Close(); _HTTPserviceHost = null; } }
static App() { DispatcherHelper.Initialize(); var serviceHost = new System.ServiceModel.Web.WebServiceHost(typeof(FluentAutomation.RemoteCommands.ServiceEndpoint), new Uri("http://localhost:10001/")); serviceHost.Open(); }
public WebServiceHost() { _tcpBaseAddress = "net.tcp://localhost:" + Globals.ClientTcpPort + "/V1"; _httpBaseAddress = "http://localhost:" + Globals.ClientHttpPort + "/V1"; List<Uri> addresses = new List<Uri>() { new Uri(_httpBaseAddress), new Uri(_tcpBaseAddress)}; _host = new System.ServiceModel.Web.WebServiceHost(typeof(Service), addresses.ToArray()); IsOpen = false; }
/// <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(); }
private void _load_web_host() { Uri _web_http_url = new Uri( System.Configuration.ConfigurationManager.AppSettings["Web_HTTP_Url"]); _web_service_host = new System.ServiceModel.Web.WebServiceHost(wcf_service, _web_http_url); //Añadimos endpoint web System.ServiceModel.Description.ServiceEndpoint epoint = _web_service_host.AddServiceEndpoint(_service_interface, new System.ServiceModel.WebHttpBinding(), _web_http_url); //Vamos a añadir la carateristica de autoformato en response System.ServiceModel.Description.WebHttpBehavior wbhttp = epoint.Behaviors.Find<System.ServiceModel.Description.WebHttpBehavior>(); if (wbhttp != null) { wbhttp.AutomaticFormatSelectionEnabled = true; wbhttp.HelpEnabled = true; } else { wbhttp = new System.ServiceModel.Description.WebHttpBehavior(); wbhttp.AutomaticFormatSelectionEnabled = true; wbhttp.HelpEnabled = true; wbhttp.FaultExceptionEnabled = true; epoint.Behaviors.Add(wbhttp); } }