Exemplo n.º 1
0
		private bool SetupWebServiceSilverlight()
		{
			Uri webServiceAddress = new Uri("http://localhost:" + SLWCFPort.ToString() + "/");
			m_webHostSilverlight = new WebServiceHost(typeof(WebServiceSilverlight), webServiceAddress);
			try
			{
				WebHttpBinding binding = new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly);
				ServiceEndpoint endpoint = m_webHostSilverlight.AddServiceEndpoint(typeof(IPolicyRetriever), binding, "");
				m_webHostSilverlight.SetEndpointAddress(endpoint, "");
				m_webHostSilverlight.Open();
			}
			catch (CommunicationException ex)
			{
				Console.WriteLine("An exception occurred: {0}", ex.Message);
				m_webHostSilverlight.Abort();
				return false;
			}

			return true;
		}