Created
April 8, 2016 18:05
-
-
Save Thorium/747ec4d82d1ea3e5fb17c893fb983931 to your computer and use it in GitHub Desktop.
Simple OWIN Self-Host web-server with static files support and request deflate/gzip compression.
This file contains hidden or 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
// Nuget packages: Owin, Microsoft.Owin, Microsoft.Owin.Hosting, Microsoft.Owin.Host.HttpListener, Owin.Compression, Microsoft.Owin.StaticFiles, Microsoft.Owin.FileSystems | |
#if INTERACTIVE | |
#I @"./packages/Owin/lib/net40" | |
#I @"./packages/Owin.Compression/lib/net45" | |
#I @"./packages/Microsoft.Owin/lib/net45" | |
#I @"./packages/Microsoft.Owin.Hosting/lib/net45" | |
#I @"./packages/Microsoft.Owin.Host.HttpListener/lib/net45" | |
#I @"./packages/Microsoft.Owin.StaticFiles/lib/net45" | |
#I @"./packages/Microsoft.Owin.FileSystems/lib/net45" | |
#r "Owin.dll" | |
#r "Microsoft.Owin.dll" | |
#r "Microsoft.Owin.FileSystems.dll" | |
#r "Microsoft.Owin.Hosting.dll" | |
#r "Microsoft.Owin.StaticFiles.dll" | |
#r "System.Configuration.dll" | |
#r "Owin.Compression.dll" | |
#endif | |
open Owin | |
open System | |
type MyStartup() = | |
member __.Configuration(app:Owin.IAppBuilder) = | |
let app1 = app.UseCompressionModule() | |
app1.UseFileServer "/." |> ignore | |
() | |
let server = Microsoft.Owin.Hosting.WebApp.Start<MyStartup> "http://*:6000" | |
Console.WriteLine "Press Enter to stop & quit." | |
Console.ReadLine() |> ignore | |
server.Dispose() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment