Program.cs
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using PerformanceService;
using System.Configuration;
namespace ConsoleHostApp
{
class Program
{
static void Main(string[] args)
{
// Start the EmailValidator Service
Type serviceType = typeof(EmailValidator);
string httpBindingAddress = ConfigurationManager.AppSettings["httpBindingAddress"];
Uri serviceUri = new Uri(httpBindingAddress + "/EmailValidator");
ServiceHost host = new ServiceHost(serviceType, serviceUri);
host.Open();
// Output some info...
#region Output dispatchers listening
foreach (Uri uri in host.BaseAddresses)
{
Console.WriteLine("\t{0}", uri.ToString());
}
Console.WriteLine();
Console.WriteLine("Number of dispatchers listening : {0}", host.ChannelDispatchers.Count);
foreach (System.ServiceModel.Dispatcher.ChannelDispatcher dispatcher in host.ChannelDispatchers)
{
Console.WriteLine("\t{0}, {1}", dispatcher.Listener.Uri.ToString(), dispatcher.BindingName);
}
Console.WriteLine();
Console.WriteLine("Press <ENTER> to terminate Host");
Console.ReadLine();
#endregion
}
}
}