Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Uri baseAddress = new Uri("http://localhost:8080/hello");
  2.  
  3. // Create the ServiceHost.
  4. using (ServiceHost host = new ServiceHost(typeof(HelloWorldService), baseAddress))
  5. {
  6. // Enable metadata publishing.
  7. ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
  8. smb.HttpGetEnabled = true;
  9. smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
  10. host.Description.Behaviors.Add(smb);
  11.  
  12. // Open the ServiceHost to start listening for messages. Since
  13. // no endpoints are explicitly configured, the runtime will create
  14. // one endpoint per base address for each service contract implemented
  15. // by the service.
  16. host.Open();
  17.  
  18. Console.WriteLine("The service is ready at {0}", baseAddress);
  19. Console.WriteLine("Press <Enter> to stop the service.");
  20. Console.ReadLine();
  21.  
  22. // Close the ServiceHost.
  23. host.Close();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement