-Kestrel +Suave

I could not get Kestrel to listen for requests on Linux, and Suave now
works with OWIN (and listens/responds on Linux as expected)
This commit is contained in:
Daniel J. Summers 2016-12-03 22:37:13 -06:00
parent 9d1a6395c9
commit f5b65d320e
3 changed files with 8 additions and 26 deletions

View File

@ -1,8 +1,5 @@
module MyWebLog.App module MyWebLog.App
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.Extensions.Configuration
open MyWebLog open MyWebLog
open MyWebLog.Data open MyWebLog.Data
open MyWebLog.Data.RethinkDB open MyWebLog.Data.RethinkDB
@ -23,6 +20,8 @@ open Nancy.TinyIoc
open Nancy.ViewEngines.SuperSimpleViewEngine open Nancy.ViewEngines.SuperSimpleViewEngine
open NodaTime open NodaTime
open RethinkDb.Driver.Net open RethinkDb.Driver.Net
open Suave
open Suave.Owin
open System open System
open System.IO open System.IO
open System.Reflection open System.Reflection
@ -151,20 +150,6 @@ type RequestEnvironment() =
null null
pipelines.BeforeRequest.AddItemToStartOfPipeline establishEnv pipelines.BeforeRequest.AddItemToStartOfPipeline establishEnv
type Startup() =
member this.Configure (app : IApplicationBuilder) =
let opt = NancyOptions ()
opt.Bootstrapper <- new MyWebLogBootstrapper ()
app.UseOwin (fun x -> x.UseNancy opt |> ignore) |> ignore
let Run () = let Run () =
use host = OwinApp.ofMidFunc "/" (NancyMiddleware.UseNancy (NancyOptions (Bootstrapper = new MyWebLogBootstrapper ())))
WebHostBuilder() |> startWebServer defaultConfig
.UseContentRoot(System.IO.Directory.GetCurrentDirectory ())
.UseUrls("http://localhost:5001")
.UseKestrel()
.UseStartup<Startup>()
.Build ()
host.Run ()

View File

@ -18,10 +18,6 @@
} }
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNetCore.Hosting": "1.0.0",
"Microsoft.AspNetCore.Owin": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"MyWebLog.Data.RethinkDB": "0.9.2", "MyWebLog.Data.RethinkDB": "0.9.2",
"MyWebLog.Entities": "0.9.2", "MyWebLog.Entities": "0.9.2",
"MyWebLog.Logic": "0.9.2", "MyWebLog.Logic": "0.9.2",
@ -30,13 +26,14 @@
"Nancy.Authentication.Forms": "2.0.0-barneyrubble", "Nancy.Authentication.Forms": "2.0.0-barneyrubble",
"Nancy.Session.Persistable": "0.9.1-pre", "Nancy.Session.Persistable": "0.9.1-pre",
"Nancy.Session.RethinkDB": "0.9.1-pre", "Nancy.Session.RethinkDB": "0.9.1-pre",
"NodaTime": "2.0.0-alpha20160729" "NodaTime": "2.0.0-alpha20160729",
"Suave": "2.0.0-rc2"
}, },
"frameworks": { "frameworks": {
"netstandard1.6": { "netstandard1.6": {
"imports": "dnxcore50", "imports": "dnxcore50",
"dependencies": { "dependencies": {
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160629", "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-161111",
"NETStandard.Library": "1.6.0" "NETStandard.Library": "1.6.0"
} }
} }

View File

@ -2,7 +2,7 @@
"buildOptions": { "buildOptions": {
"emitEntryPoint": true, "emitEntryPoint": true,
"copyToOutput": { "copyToOutput": {
"include": [ "views", "content" ] "include": [ "views", "content", "config.json" ]
} }
}, },
"dependencies": { "dependencies": {