Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/19/16 12:45:18 (9 years ago)
Author:
thasling
Message:

Implemented P2PTask-class
Changed communication protocoll http --> net.tcp
Logger is now Parameter of P2PTask

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/thasling/DistributedGA/DistributedGA.ContactServer.Host/Program.cs

    r13524 r13557  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    42using System.ServiceModel;
    5 using System.ServiceModel.Description;
    6 using System.Text;
    7 using System.Threading.Tasks;
    83
    9 namespace DistributedGA.ContactServer.Host
    10 {
    11     class Program
    12     {
    13         static void Main(string[] args)
    14         {
    15             string baseAddress = string.Empty;
    16             if(args.GetUpperBound(0) > -1)
    17             {
    18                baseAddress = args[0];
    19             }
    20             if (string.IsNullOrWhiteSpace(baseAddress))
    21             {
    22                 baseAddress = "http://localhost:9090/DistributedGA.ContactServer/ContactService";
    23             }
    24             using (ServiceHost host = new ServiceHost(typeof(ContactServiceImpl), new Uri[] { new Uri(baseAddress) }))
    25             {
    26                 // Enable metadata publishing.
    27                 ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
    28                 smb.HttpGetEnabled = true;
    29                 smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
    30                 host.Description.Behaviors.Add(smb);
     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.
    3116
    32                 // Open the ServiceHost to start listening for messages. Since
    33                 // no endpoints are explicitly configured, the runtime will create
    34                 // one endpoint per base address for each service contract implemented
    35                 // by the service.
    36                
    37                 host.Open();
    3817
    39                 Console.WriteLine("The service is ready at {0}", baseAddress);
    40                 Console.WriteLine("Press <Enter> to stop the service.");
    41                 Console.ReadLine();
     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.
    4222
    43                 // Close the ServiceHost.
    44                 host.Close();
    45             }
    46         }
     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      }
    4732    }
     33  }
    4834}
Note: See TracChangeset for help on using the changeset viewer.