使用OWIN为自托管的ASP.NET Web API时,每个请求的数据应该怎么保存 [英] How should I store per request data when using OWIN to Self-Host ASP.NET Web API

查看:419
本文介绍了使用OWIN为自托管的ASP.NET Web API时,每个请求的数据应该怎么保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在被IIS托管到被托管的自我转换我的ASP.NET Web API的过程。

I'm in the process of converting my ASP.NET Web API from being IIS hosted to being self hosted.

在我的 DelegatingHandlers之一我设置当前用户基于HTTP头令牌。我已经使用了 HttpContext.Current.Items 来存储这些信息,但不是在自我主机可用。

In one of my DelegatingHandlers I set the current user based on the token from the HTTP header. I've been using HttpContext.Current.Items to store this information, but that isn't available under self hosting.

什么是每个可随时随地在我的应用程序访问请求数据存储的正确方法?

What is the correct way to store per request data that can be accessed anywhere in my application?

推荐答案

请求消息有一个属性集。

The Request message has a Properties collection.

这篇关于使用OWIN为自托管的ASP.NET Web API时,每个请求的数据应该怎么保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆