Last change
on this file since 13887 was
13887,
checked in by thasling, 8 years ago
|
prepared protoype for next meeting
|
File size:
1.3 KB
|
Rev | Line | |
---|
[13524] | 1 | using System;
|
---|
| 2 | using System.ServiceModel;
|
---|
| 3 |
|
---|
[13887] | 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.
|
---|
[13524] | 22 |
|
---|
| 23 |
|
---|
[13887] | 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.
|
---|
[13524] | 28 |
|
---|
[13887] | 29 | host.Open();
|
---|
[13557] | 30 |
|
---|
[13887] | 31 | Console.WriteLine("The service is ready at {0}", baseAddress);
|
---|
| 32 | Console.WriteLine("Press <Enter> to stop the service.");
|
---|
| 33 | Console.ReadLine();
|
---|
[13557] | 34 |
|
---|
[13887] | 35 | // Close the ServiceHost.
|
---|
| 36 | host.Close();
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
[13524] | 39 | }
|
---|
| 40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.