owin

The name 'ConfigureAuth' does not exist in the current contex

主宰稳场 提交于 2019-12-09 15:53:42
问题 I'm getting an error when I'm attempting to run my page says that, The name 'ConfigureAuth' does not exist in the current context in my Stratup Class. I'm sure all AspNet Identity libraries are installed. What do I need to do next, to try to fix this? using Microsoft.Owin; using Owin; [assembly: OwinStartupAttribute(typeof(project_name.Startup))] namespace project_name { public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } } 回答1: If you are using

Is there a way to convert OwinRequest to HttpRequestBase?

孤街醉人 提交于 2019-12-09 15:46:21
问题 I'm writing a piece of Owin Middleware, where I need to use some legacy code, which uses HttpRequestBase as method argument. The legacy code does not follow SOLID so It's impossible to extend it to use OwinRequest instead of HttpRequestBase Is there an extension (or a way) to convert an OwinRequest into a HttpRequestBase? 回答1: If you have access to the IOwinContext of the request, you can use this little hack to get the HttpContextBase : HttpContextBase httpContext = context.Get

SignalR Websocket Exception when closing client

跟風遠走 提交于 2019-12-09 15:37:44
问题 When starting and stopping a SignalR client that is connected to a basic self hosted server like this: async public void Start(string url) { _connection = new HubConnection(url); _proxy = _connection.CreateHubProxy("hubname"); await _connection.Start().ContinueWith((task) => IsRunning = true); } public void Stop() { _connection.Stop(); } I get the following exception when calling the "Stop" method (including trace messages): SignalR.Transports.TransportHeartBeat Verbose: 0 : KeepAlive

Host Web API as Windows Service using OWIN

不羁的心 提交于 2019-12-09 15:34:13
问题 I'm trying to run a Web API application as a Windows Service using OWIN. However, I get the following message, when trying to start the service: The [ServiceName] service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs. For some reason my service doesn't understand that it should keep listening to http://localhost:9000 The VS solution consists of two projects: The Web API and the Windows service. In the Windows

How to get ApplicationDbContext out of the Owin pipeline

强颜欢笑 提交于 2019-12-09 14:48:09
问题 This has to be simple, but I'm going bug-eyed trying to find the answer. How does a controller action get a reference to the per-request ApplicationDbContext that was stashed in the Owin pipeline? EDIT: Ok, I think I'm getting closer... or maybe not... All of my Googling seems to lead to this blog post, which sez to use: var dbContext = context.Get<ApplicationDbContext>(); where context is apparently an instance of Microsoft.Owin.IOwinContext . So I tried: var db = HttpContext.GetOwinContext(

How to keep user login in to system and logout only after user clicks on logout button?

一笑奈何 提交于 2019-12-09 14:35:00
问题 I am using custom implementation of microsoft asp.net identity because i have custom tables that is why i have given custom implementation of all my methods IUserStore and IUserPasswordStore . Problem is when user logins then after 10 - 15 minutes login user session gets expired but what i want is unless user logs out i want to keep user login in to the system. Code: public partial class Startup { public void ConfigureAuth(IAppBuilder app) { app.CreatePerOwinContext(ApplicationDbContext

How do I get System.Web.Http.Owin?

↘锁芯ラ 提交于 2019-12-09 14:03:44
问题 I had a version number problem with system.web.http.owin. So I removed it from my projects package references, with the idea that I would re-added it to see if it fixed the problem. However it has disappeared completely. I.e. in visual studio if I go: solution explorer > myProject > references > RMC > add reference > and then search for system.web.http.owin it doesn't appear. Any ideas what has gone wrong or what package I need to install to make it re-appear. My original error message...

How to implement an OWIN Authentication server with a MVC Web Api content server and an Android end-user apk

倾然丶 夕夏残阳落幕 提交于 2019-12-09 13:11:22
问题 I am trying to implement: An MVC Web API server to return content on-demand (REST Server) A Central authentication OAuth 2.0 server (for example OWIN) An Android end-user side Application The Scenario is like this: Android application requests content on REST Server, if its token is expired, REST server makes a request on authentication server to identify the client. The REST server should be registered using its own [id,secret] on authentication server and then Android application should be

GetExternalLoginInfoAsync() loginInfo return null - but only after a few hours

陌路散爱 提交于 2019-12-09 12:29:48
问题 I'm using Strava as my external login provider (I assume this is not related to Strava, could be google or facebook also) After running for a few hours / days or even weeks GetExternalLoginInfoAsync return null. I've read a bunch of other questions with the same problem, but did not find a solution. I post my entire ConfigureAuth method, just in case I did something wrong with the order. If you have a strava account you could probably experience the problem here: fartslek.no/Account/Login

Register certificate to SSL port

流过昼夜 提交于 2019-12-09 11:17:12
问题 I have a windows service (running as LocalSystem) that is self-hosting an OWIN service (SignalR) and needs to be accessed over SSL. I can set up the SSL binding on my local development machine just fine - and I can access my service over SSL on that same machine. However, when I go to another machine and try to run the following command I receive an error: Command: netsh http add sslcert ipport=0.0.0.0:9389 appid={...guid here...} certhash=...cert hash here... Error: SSL Certificate add