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