Initial
This commit is contained in:
34
Program.cs
Normal file
34
Program.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.SelfHost;
|
||||
using MarketDataServer.Authorization;
|
||||
using MarketDataServer.Handlers;
|
||||
|
||||
namespace MarketDataServer
|
||||
{
|
||||
// Needs to be run as administrator or use the following netsh http add urlacl url=http://+:8000/ user=[europa]\[skess]
|
||||
// netsh http add urlacl url=http://+:8000/ user=europa\sean
|
||||
class Program
|
||||
{
|
||||
static readonly Uri _baseAddress = new Uri("http://localhost:8000/");
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Authorizations.GetInstance().IsEnabled = true;
|
||||
// Set up server configuration
|
||||
HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(_baseAddress);
|
||||
config.Routes.MapHttpRoute(name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional });
|
||||
config.MessageHandlers.Add(new CustomHeaderHandler());
|
||||
// Create server
|
||||
var server = new HttpSelfHostServer(config);
|
||||
// Start listening
|
||||
server.OpenAsync().Wait();
|
||||
Console.WriteLine("Web API Self hosted on " + _baseAddress + " Hit ENTER to exit...");
|
||||
Console.ReadLine();
|
||||
server.CloseAsync().Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user