owin

Shouldn't OwinStartupAttribute run before global.asax and Application_Start?

落爺英雄遲暮 提交于 2019-12-23 10:28:22
问题 I need to run code before application start and up until now I have used WebActivator to do that but if I understand correctly the OwinStartupAttribute is more suitable for that but the problem for me is that it runs after Application_Start in Global.asax , is this correct or can I configure it to run pre application start? 回答1: According to this answer it runs slightly after Application_Start. So if you, just like me need to run code before Application_Start, WebActivator is still the way to

Shouldn't OwinStartupAttribute run before global.asax and Application_Start?

不问归期 提交于 2019-12-23 10:27:09
问题 I need to run code before application start and up until now I have used WebActivator to do that but if I understand correctly the OwinStartupAttribute is more suitable for that but the problem for me is that it runs after Application_Start in Global.asax , is this correct or can I configure it to run pre application start? 回答1: According to this answer it runs slightly after Application_Start. So if you, just like me need to run code before Application_Start, WebActivator is still the way to

OWIN Stop Server\Service?

巧了我就是萌 提交于 2019-12-23 09:32:23
问题 Using a c# winforms app to start owin Created a Startup config file [assembly: OwinStartup(typeof(Chatter.Host.Startup))] namespace Chatter.Host { public class Startup { public void Configuration(IAppBuilder app) { // Any connection or hub wire up and configuration should go here app.MapSignalR(); } } And then on my windows form: private void StartServer() { try { SignalR = WebApp.Start(URL); } catch (TargetInvocationException) { //Todo } this.Invoke((Action) (() => richTextBox1.AppendText(

Microsoft.Owin.StaticFiles works in console host but I get a 404 in IIS on file requests

独自空忆成欢 提交于 2019-12-23 07:55:55
问题 I have Microsoft.Owin.FileServer (v2.1.0) set up in my Owin pipeline, and setting up FileServerOptions with EnableDirectoryBrowsing = true works great for showing the directory contents in both my console host and iisexpress. It's when I try to view a particular file (so, the StaticFiles part) I have problems in iisexpress. Still works great in the console host, but in iisexpress I get a 404: HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed,

With SerilogWeb.Owin discontinued, is there an “official” integration?

ⅰ亾dé卋堺 提交于 2019-12-23 07:29:09
问题 I came across the discontinuation notice of the SerilogWeb.Owin package, and in reading the GitHub issue there was discussion about "redirecting folks somewhere" given the ~5K+ downloads of the package. But I haven't been able to figure out where I'm being redirected to! So where should I be looking for a "Serilog-blessed" integration for using Serilog with an (OWIN) self-hosted Web API? 回答1: The package boils down to the following, which I derived from the issues in [the repo](https://github

Microsoft Owin Logging - Web Api 2 - How do I create the logger?

旧城冷巷雨未停 提交于 2019-12-23 07:22:40
问题 I am trying to add logging to my app using Web Api 2 and Owin, so I started using Microsoft Owin Logging, which requires an ILogger and ILoggerFactory , that has been implemented and it works great when I need to log anything inside the STARTUP method or any of the Owin Middleware components. For example, when I am in the Startup method I can create the logger using: public void Configuration(IAppBuilder app) { // Creates configuration var configuration = new HttpConfiguration(); // Configure

Web API token authentication

好久不见. 提交于 2019-12-23 05:41:35
问题 I'm posting user credentials from a web app to the web api which implements a provider that authenticates the user and responds with a valid token. This is the method that posts: public TokenModel RequestAPIToken(string username, string password) { var postData = new Dictionary<string, string>(); postData.Add("grant_type", "password"); postData.Add("username ", username); postData.Add("password ", password); HttpContent content = new FormUrlEncodedContent(postData); _response = _client

How to add parameters to redirect_uri in WebApi Oauth Owin authentication process?

﹥>﹥吖頭↗ 提交于 2019-12-23 04:58:34
问题 I'm creating a webapi project with oauth bearer token authenthication and external login providers (google, twitter, facebook etc.). I started with the basic VS 2013 template and got everything to work fine! However, after a user successfully logs is, the owin infrastructure creates a redirect with the folllowing structure: http://some.url/#access_token=<the access token>&token_type=bearer&expires_in=1209600 In my server code I want to add an additional parameter to this redirect because in

Owin authentication between MVC 5 and Web API (separate IIS applications)

走远了吗. 提交于 2019-12-23 04:56:26
问题 I have a working app with MVC5 and Web API (both different IIS applications) using Forms Authentication and Bearer token. Yes, they must remain two separate IIS applications. I am using the auth token as the username in my Forms Authentication cookie and that's how I am able to pass the token back and forth from MVC and Web API. I am also using Asp.net Identity 2.0. I would like to take Forms Authentication out of the equation and just use Owin Authentication but the User.Identity

Owin authentication between MVC 5 and Web API (separate IIS applications)

我怕爱的太早我们不能终老 提交于 2019-12-23 04:55:46
问题 I have a working app with MVC5 and Web API (both different IIS applications) using Forms Authentication and Bearer token. Yes, they must remain two separate IIS applications. I am using the auth token as the username in my Forms Authentication cookie and that's how I am able to pass the token back and forth from MVC and Web API. I am also using Asp.net Identity 2.0. I would like to take Forms Authentication out of the equation and just use Owin Authentication but the User.Identity