OWIN app.use vs app.run vs app.map [英] OWIN app.use vs app.run vs app.map
问题描述
Owin 中的app.use
,app.run
,app.map
有什么区别? ?什么时候使用什么?阅读文档时并不容易.
app.use
将中间件插入到管道中,这要求您通过调用next.Invoke()来调用下一个中间件.
app.run
插入没有下一个中间件的中间件,因此它可以运行.
使用app.map
,您可以映射路径(仅在请求路径与您映射的模式匹配时),以便在运行时针对每个请求进行评估,以运行某些中间件.
请参阅 use
和run
的文档和 map
了解更多详细信息>
What's the difference among app.use
, app.run
, app.map
in Owin? When to use what? It's not straightforward when reading the documentation.
app.use
inserts a middleware into the pipeline which requires you to call the next middleware by calling next.Invoke().
app.run
inserts a middleware without a next, so it just runs.
With app.map
you can map paths, which get evaluated at runtime, per request, to run certain middleware only if the request path matches the pattern you mapped.
See docs for use
and run
and map
for more details
这篇关于OWIN app.use vs app.run vs app.map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!