Line | |
---|
1 | using System;
|
---|
2 | using System.ServiceModel;
|
---|
3 |
|
---|
4 | namespace 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.