Last change
on this file since 13546 was
13524,
checked in by thasling, 8 years ago
|
Upload des Projekts letztendlich, trotz buggendes Clients...
|
File size:
1.7 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.ServiceModel;
|
---|
5 | using System.ServiceModel.Description;
|
---|
6 | using System.Text;
|
---|
7 | using System.Threading.Tasks;
|
---|
8 |
|
---|
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);
|
---|
31 |
|
---|
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();
|
---|
38 |
|
---|
39 | Console.WriteLine("The service is ready at {0}", baseAddress);
|
---|
40 | Console.WriteLine("Press <Enter> to stop the service.");
|
---|
41 | Console.ReadLine();
|
---|
42 |
|
---|
43 | // Close the ServiceHost.
|
---|
44 | host.Close();
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.