Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2615:
delete unneeded project, appended code style

File size: 1.1 KB
RevLine 
[13524]1using System;
2using System.ServiceModel;
3
[13924]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.
[13524]16
17
[13924]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.
[13524]22
[13924]23        host.Open();
[13557]24
[13924]25        Console.WriteLine("The service is ready at {0}", baseAddress);
26        Console.WriteLine("Press <Enter> to stop the service.");
27        Console.ReadLine();
[13557]28
[13924]29        // Close the ServiceHost.
30        host.Close();
31      }
[13524]32    }
[13924]33  }
[13524]34}
Note: See TracBrowser for help on using the repository browser.