Last change
on this file since 13791 was
13557,
checked in by thasling, 9 years ago
|
Implemented P2PTask-class
Changed communication protocoll http --> net.tcp
Logger is now Parameter of P2PTask
|
File size:
1.1 KB
|
Rev | Line | |
---|
[13524] | 1 | using System;
|
---|
| 2 | using System.ServiceModel;
|
---|
| 3 |
|
---|
[13557] | 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.
|
---|
[13524] | 16 |
|
---|
| 17 |
|
---|
[13557] | 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 |
|
---|
[13557] | 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 | }
|
---|
[13524] | 32 | }
|
---|
[13557] | 33 | }
|
---|
[13524] | 34 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.