Closed NigeB closed 8 years ago
Self-hosted? Well, depends what libraries you were using. There's a SystemWeb for IIS hosting, and an Owin for Katana hosting.
Yep. I use SystemWeb for hosting on the iis server, but Owin for running it in a console window on my local machine. That should work, right?
Well, if that's the case then I don't think you should see any code trying to access HttpContext.Current in the OWIN hosted scenario.
Hi Brock.
I've been hosting IdentityServer3 and MR with two factor in a console app using Owin.SelfHost nicely for a while, but it has suddenly stopped working.
The problem is when I enable two factor - I call userAccountService.Authenticate() and MR goes off to MembershipReboot.WebHost.AspNetCookieBasedTwoFactorAuthPolicy.GetCookie() to get the cookie but fails because HttpContext.Current is null.
Tracing it through, HttpContext.Current is null all the way through the code. I kind of get this, as I thought this was normal for Owin based applications, but you use it in GetCookie(), so that can't be the case. AND it worked until a couple of days ago(!)
I don't know what I changed, but to save my sanity, I created a brand new project, installed the Owin.Selfhost package, IdentityServer3, and MR, and it all works except when I want to use two factor and HttpContext.Current is null.
It all works fine hosted on IIS, of course, but I really rely on the self hosted app for dev.
I've exhausted all other options - I can't see anything on the issues about this. Have I forgotten something crucial?
Thanks Brock.
ps. I'm using the latest packages - see here: