From f5b65d320e6580bc493c6b422a555a44ef68f445 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 3 Dec 2016 22:37:13 -0600 Subject: [PATCH] -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) --- src/MyWebLog.App/App.fs | 23 ++++------------------- src/MyWebLog.App/project.json | 9 +++------ src/MyWebLog/project.json | 2 +- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/MyWebLog.App/App.fs b/src/MyWebLog.App/App.fs index 4a51d6f..96a3a13 100644 --- a/src/MyWebLog.App/App.fs +++ b/src/MyWebLog.App/App.fs @@ -1,8 +1,5 @@ module MyWebLog.App -open Microsoft.AspNetCore.Builder -open Microsoft.AspNetCore.Hosting -open Microsoft.Extensions.Configuration open MyWebLog open MyWebLog.Data open MyWebLog.Data.RethinkDB @@ -23,6 +20,8 @@ open Nancy.TinyIoc open Nancy.ViewEngines.SuperSimpleViewEngine open NodaTime open RethinkDb.Driver.Net +open Suave +open Suave.Owin open System open System.IO open System.Reflection @@ -151,20 +150,6 @@ type RequestEnvironment() = null 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 () = - use host = - WebHostBuilder() - .UseContentRoot(System.IO.Directory.GetCurrentDirectory ()) - .UseUrls("http://localhost:5001") - .UseKestrel() - .UseStartup() - .Build () - host.Run () + OwinApp.ofMidFunc "/" (NancyMiddleware.UseNancy (NancyOptions (Bootstrapper = new MyWebLogBootstrapper ()))) + |> startWebServer defaultConfig diff --git a/src/MyWebLog.App/project.json b/src/MyWebLog.App/project.json index 3337bdd..9d8feea 100644 --- a/src/MyWebLog.App/project.json +++ b/src/MyWebLog.App/project.json @@ -18,10 +18,6 @@ } }, "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.Entities": "0.9.2", "MyWebLog.Logic": "0.9.2", @@ -30,13 +26,14 @@ "Nancy.Authentication.Forms": "2.0.0-barneyrubble", "Nancy.Session.Persistable": "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": { "netstandard1.6": { "imports": "dnxcore50", "dependencies": { - "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160629", + "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-161111", "NETStandard.Library": "1.6.0" } } diff --git a/src/MyWebLog/project.json b/src/MyWebLog/project.json index 392b414..d108274 100644 --- a/src/MyWebLog/project.json +++ b/src/MyWebLog/project.json @@ -2,7 +2,7 @@ "buildOptions": { "emitEntryPoint": true, "copyToOutput": { - "include": [ "views", "content" ] + "include": [ "views", "content", "config.json" ] } }, "dependencies": {