-
Notifications
You must be signed in to change notification settings - Fork 266
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (43 loc) · 1.63 KB
/
Program.cs
File metadata and controls
51 lines (43 loc) · 1.63 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
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Diagnostics;
using ServiceStack;
using ServiceStack.Configuration;
using StarterTemplates.Common;
using Funq;
namespace ConsoleAppHost
{
class Program
{
private static readonly string ListeningOn = ConfigUtils.GetAppSetting("ListeningOn");
/// <summary>
/// Create your ServiceStack http listener application with a singleton AppHost.
/// </summary>
public class AppHost : AppHostHttpListenerBase
{
/// <summary>
/// Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
/// </summary>
public AppHost() : base("StarterTemplate HttpListener", typeof(HelloService).Assembly) { }
/// <summary>
/// Configure the container with the necessary routes for your ServiceStack application.
/// </summary>
/// <param name="container">The built-in IoC used with ServiceStack.</param>
public override void Configure(Container container)
{
container.Register(new TodoRepository());
}
}
static void Main(string[] args)
{
var appHost = new AppHost();
appHost.Init();
appHost.Start(ListeningOn);
Console.WriteLine("Started listening on: " + ListeningOn);
Console.WriteLine("AppHost Created at {0}, listening on {1}",
DateTime.Now, ListeningOn);
Process.Start(ListeningOn);
Console.WriteLine("ReadKey()");
Console.ReadKey();
}
}
}