Last active
August 29, 2015 14:19
-
-
Save Dykam/5b0b8e33fa0cd7294e0d to your computer and use it in GitHub Desktop.
Small stand-alone URL-echoing server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Owin; | |
using Microsoft.Owin.Hosting; | |
using Owin; | |
using System; | |
using System.Net.Http; | |
namespace SelfHost | |
{ | |
public class Program | |
{ | |
public void Main(string[] args) | |
{ | |
var baseAddress = "http://localhost:9000/"; | |
using (WebApp.Start<Startup>(url: baseAddress)) | |
{ | |
Console.WriteLine("Press a key to stop the server..."); | |
Console.ReadKey(true); | |
} | |
} | |
} | |
public class Startup | |
{ | |
public void Configuration(IAppBuilder appBuilder) | |
{ | |
appBuilder.Run(context => | |
{ | |
return context.Response.WriteAsync(context.Request.Path.Value); | |
}); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "1.0.0-*", | |
"dependencies": { | |
"Microsoft.AspNet.WebApi.OwinSelfHost": "5.2.3", | |
"Microsoft.AspNet.Mvc": "5.2.3" | |
}, | |
"commands": { | |
"run": "run" | |
}, | |
"frameworks": { | |
"aspnet50": { | |
"dependencies": { | |
"System.Console": "4.0.0-beta-22523" | |
} | |
} | |
}, | |
"compilationOptions": { | |
"languageVersion": "csharp6" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment