gpt4 book ai didi

asp.net-web-api - 何时使用 HttpMessageHandler 与 ActionFilter?

转载 作者:行者123 更新时间:2023-12-03 06:07:19 25 4
gpt4 key购买 nike

看来这两者有着相似的目的。如果能看到一些示例,了解何时使用其中一种的优点和缺点,并指出主要区别是什么,那就太好了。

最佳答案

The major difference between their two is their focus. Message Handlers are applied to all HTTP requests. They perform the function of an HTTP intermediary. Filters apply only to requests that are dispatched to the particular controller/action where the filter is applied.

You should use MessageHandlers when you want the behaviour to be applied to the vast majority of requests. Filters should be used when they are only applicable to certain resources.

enter image description here

关于asp.net-web-api - 何时使用 HttpMessageHandler 与 ActionFilter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11123015/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com