OWIN app.use vs app.run vs app.map

2019-04-04 01:11发布

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.

1条回答
可以哭但决不认输i
2楼-- · 2019-04-04 01:47

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

查看更多
登录 后发表回答