public static void Main () { var url = "http://localhost:8080"; var host = new MyHostFactory ().CreateServiceHost (typeof (HogeService)); var binding = new WebHttpBinding (); host.AddServiceEndpoint (typeof (IHogeService), binding, url); host.Open (); //Console.WriteLine ("js:"); //Console.WriteLine (new WebClient () // .DownloadString (url + "/js")); Console.WriteLine ("jsdebug:"); Console.WriteLine (new WebClient () .DownloadString (url + "/jsdebug")); Console.WriteLine (new WebClient () .DownloadString (url + "/Join?s1=foo&s2=bar")); Console.WriteLine (new WebClient () .DownloadString (url + "/ToComplex?real=3&unreal=4")); foreach (ChannelDispatcher cd in host.ChannelDispatchers) { Console.WriteLine ("BindingName: " + cd.BindingName); Console.WriteLine (cd.Listener.Uri); foreach (var o in cd.Endpoints [0].DispatchRuntime.Operations) Console.WriteLine ("OP: {0} {1}", o.Name, o.Action); } Console.WriteLine ("Type [CR] to close ..."); Console.ReadLine (); host.Close (); }
public static void Main() { var url = "http://localhost:8080"; var host = new MyHostFactory().CreateServiceHost(typeof(HogeService)); var binding = new WebHttpBinding(); host.AddServiceEndpoint(typeof(IHogeService), binding, url); host.Open(); //Console.WriteLine ("js:"); //Console.WriteLine (new WebClient () // .DownloadString (url + "/js")); Console.WriteLine("jsdebug:"); Console.WriteLine(new WebClient() .DownloadString(url + "/jsdebug")); Console.WriteLine(new WebClient() .DownloadString(url + "/Join?s1=foo&s2=bar")); Console.WriteLine(new WebClient() .DownloadString(url + "/ToComplex?real=3&unreal=4")); foreach (ChannelDispatcher cd in host.ChannelDispatchers) { Console.WriteLine("BindingName: " + cd.BindingName); Console.WriteLine(cd.Listener.Uri); foreach (var o in cd.Endpoints[0].DispatchRuntime.Operations) { Console.WriteLine("OP: {0} {1}", o.Name, o.Action); } } Console.WriteLine("Type [CR] to close ..."); Console.ReadLine(); host.Close(); }
// It is not working with mono! public static void Main () { string url = "http://localhost:8080/"; WebHttpBinding b = new WebHttpBinding (); var host = new MyHostFactory ().DoCreateServiceHost (typeof (MyService), new Uri (url)); ServiceEndpoint se = host.AddServiceEndpoint ("MyService", b, url); host.Open (); Console.WriteLine ("--- enter ---"); Console.ReadLine (); host.Close (); }
// It is not working with mono! public static void Main() { string url = "http://localhost:8080/"; WebHttpBinding b = new WebHttpBinding(); var host = new MyHostFactory().DoCreateServiceHost(typeof(MyService), new Uri(url)); ServiceEndpoint se = host.AddServiceEndpoint("MyService", b, url); host.Open(); Console.WriteLine("--- enter ---"); Console.ReadLine(); host.Close(); }