Free cookie consent management tool by TermsFeed Policy Generator

source: branches/thasling/DistributedGA/DistributedGA.ContactServer.Host/Program.cs @ 13924

Last change on this file since 13924 was 13924, checked in by thasling, 6 years ago

#2615:
delete unneeded project, appended code style

File size: 1.1 KB
Line 
1using System;
2using System.ServiceModel;
3
4namespace DistributedGA.ContactServer.Host {
5  class Program {
6    static void Main(string[] args) {
7      string baseAddress = string.Empty;
8      if (args.GetUpperBound(0) > -1) {
9        baseAddress = args[0];
10      }
11      if (string.IsNullOrWhiteSpace(baseAddress)) {
12        baseAddress = "net.tcp://localhost:9090/DistributedGA.ContactServer/ContactService";
13      }
14      using (ServiceHost host = new ServiceHost(typeof(ContactServiceImpl), new Uri[] { new Uri(baseAddress) })) {
15        // Enable metadata publishing.
16
17
18        // Open the ServiceHost to start listening for messages. Since
19        // no endpoints are explicitly configured, the runtime will create
20        // one endpoint per base address for each service contract implemented
21        // by the service.
22
23        host.Open();
24
25        Console.WriteLine("The service is ready at {0}", baseAddress);
26        Console.WriteLine("Press <Enter> to stop the service.");
27        Console.ReadLine();
28
29        // Close the ServiceHost.
30        host.Close();
31      }
32    }
33  }
34}
Note: See TracBrowser for help on using the repository browser.