[Mono-bugs] [Bug 626950] HttpWebRequest_WebException_RemoteServer using ServiceHost

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jul 30 04:53:02 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=626950

http://bugzilla.novell.com/show_bug.cgi?id=626950#c1


--- Comment #1 from Daniele Balbini <daniele.bini at gmail.com> 2010-07-30 08:53:01 UTC ---
A little sample of the service hosted
#region hosting the service 

      Uri baseAddress = new Uri("http://127.0.0.1:18080/MyDaemon"); 
      string address = "http://127.0.0.1:18080/MyDaemon"; 

      using (ServiceHost host = new ServiceHost(typeof(CommunicatorServices),
baseAddress)) 
      { 
        BasicHttpBinding binding = new
BasicHttpBinding(BasicHttpSecurityMode.None); 
        host.AddServiceEndpoint(typeof(ICommunicatorServices), binding,
address); 

        ServiceMetadataBehavior serviceMetadataBehavior =
host.Description.Behaviors.Find<ServiceMetadataBehavior>(); 

        if (serviceMetadataBehavior == null) 
        { 
          serviceMetadataBehavior = new ServiceMetadataBehavior(); 
          host.Description.Behaviors.Add(serviceMetadataBehavior); 
        } 
        host.AddServiceEndpoint(typeof(IMetadataExchange),
MetadataExchangeBindings.CreateMexHttpBinding(),
"http://127.0.0.1:18080/MyDaemon/mex"); 

        host.Open(); 
        Console.WriteLine("Service is running....press any key to terminate."); 
        Console.ReadKey(); 
        host.Close(); 
#endregion

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list