NServiceBus - 如何在消息信封中传递自定义标头?

发布于 2024-09-02 05:51:28 字数 102 浏览 2 评论 0原文

我希望能够附加 Windows 身份验证令牌,而不必在消息本身中包含该数据。

我注意到 TransportMessage 有标头,但是在将消息发送到服务器之前如何访问该标头?

I want to be able to attach the windows authentication token without having to include that piece of data on the messages themselves.

I've noticed that TransportMessage has Headers, but how do I get access to that before Send message to server?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

め七分饶幸 2024-09-09 05:51:28

请参阅标头操作示例,您将了解如何使用标头。

要为客户端设置恒定的传出标头(适合您想要的身份验证令牌),请参阅 为所有传出消息写入传出标头

在服务器上,您可以读取标头

See the Header Manipulation Sample there you'll see how to use headers.

To set a constant outgoing header for a client (suitable for the auth token you want), see Writing outgoing headers for all outgoing-messages

On the server, you can then Read the header.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文