Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching issue with Owin self host #1199

Closed
dtchepak opened this issue Apr 5, 2016 · 2 comments
Closed

Caching issue with Owin self host #1199

dtchepak opened this issue Apr 5, 2016 · 2 comments

Comments

@dtchepak
Copy link
Member

dtchepak commented Apr 5, 2016

Sorry for the vague report. I have a fake script that starts up a simple web server. The first time I run it everything is fine, but subsequent times I get:

System.MissingMemberException: The server factory could not be located for the given input: Microsoft.Owin.Host.HttpListener
   at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveServerFactory(StartContext context)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
   at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options, Action`1 startup)
   at FSI_0005.Build.clo@16.Invoke(Unit _arg1)
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 489

If I disable caching using fake.exe build.fsx web -nc it works all the time. I am using FAKE 4.23. Not sure if this is related to the issue described here, but that suggested fix didn't resolve it for me.


Fake script:

#I @"packages/build/FAKE/tools"
#r "FakeLib.dll"
#r @"packages/build/Owin/lib/net40/Owin.dll"
#r @"packages/build/Microsoft.Owin/lib/net45/Microsoft.Owin.dll"
#r @"packages/build/Microsoft.Owin.Hosting/lib/net45/Microsoft.Owin.Hosting.dll"
#r @"packages/build/Microsoft.Owin.Host.HttpListener/lib/net45/Microsoft.Owin.Host.HttpListener.dll"
#r @"packages/build/Microsoft.Owin.StaticFiles/lib/net45/Microsoft.Owin.StaticFiles.dll"
#r @"packages/build/Microsoft.Owin.FileSystems/lib/net45/Microsoft.Owin.FileSystems.dll"

open Fake
open Owin
open Microsoft.Owin.Hosting
open System

// Based on:
//   http://odetocode.com/blogs/scott/archive/2014/02/10/building-a-simple-file-server-with-owin-and-katana.aspx

Target "web" <| fun _ ->
    use app = WebApp.Start("http://localhost:8080", fun builder -> builder.UseFileServer(false) |> ignore)
    printfn "Started web server on 8080"
    printfn "Press any key exit."
    Console.ReadKey() |> ignore
    app.Dispose()

RunTargetOrListTargets ()

Paket dependencies to get the fake script to work:

source https://www.nuget.org/api/v2/
framework >= net461
group Build
  source https://www.nuget.org/api/v2/
  nuget FAKE
  nuget Microsoft.Owin.SelfHost
  nuget Microsoft.Owin.StaticFiles
@forki
Copy link
Member

forki commented Apr 5, 2016

/cc @matthid

@matthid
Copy link
Member

matthid commented Apr 7, 2016

Nice find!
Should be fixed now. took me a while to figure this one out so thanks @dtchepak for the easy repro!

@forki forki closed this as completed in 8dcfa9a Apr 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants