public static void Main() { // NetTcpBinding binding; // CustomBinding binding; BasicHttpBinding binding; CustomPeerResolverService cprs; // ServiceEndpoint se; ServiceHost sh; try { cprs = new MyCustomPeerResolverService(); sh = new ServiceHost(cprs); // binding = new NetTcpBinding (); // binding = new CustomBinding (); // binding.Elements.Add (new TextMessageEncodingBindingElement ()); // binding.Elements.Add (new TcpTransportBindingElement ()); binding = new BasicHttpBinding(); // binding.Security.Mode = SecurityMode.None; sh.AddServiceEndpoint(typeof(IPeerResolverContract), binding, new Uri("http://localhost:8080/ChatServer")); cprs.ControlShape = true; cprs.Open(); sh.Open(); Console.WriteLine("Server started successfully."); Console.ReadLine(); cprs.Close(); sh.Close(); } catch (Exception e) { Console.WriteLine("[!] {0}", e.Message); } }
public static void Main () { // NetTcpBinding binding; // CustomBinding binding; BasicHttpBinding binding; CustomPeerResolverService cprs; // ServiceEndpoint se; ServiceHost sh; try { cprs = new MyCustomPeerResolverService (); sh = new ServiceHost (cprs); // binding = new NetTcpBinding (); // binding = new CustomBinding (); // binding.Elements.Add (new TextMessageEncodingBindingElement ()); // binding.Elements.Add (new TcpTransportBindingElement ()); binding = new BasicHttpBinding (); // binding.Security.Mode = SecurityMode.None; sh.AddServiceEndpoint (typeof (IPeerResolverContract), binding, new Uri ("http://localhost:8080/ChatServer")); cprs.ControlShape = true; cprs.Open (); sh.Open (); Console.WriteLine ("Server started successfully."); Console.ReadLine (); cprs.Close (); sh.Close (); } catch (Exception e) { Console.WriteLine ("[!] {0}", e.Message); } }