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); } }
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); } }