我应该在哪里插入 WCF 才能在消息到达时收到通知?

发布于 2024-07-06 17:06:14 字数 164 浏览 4 评论 0原文

我正在编写一个示例控制台服务主机,我希望插入 WCF 堆栈,以便能够在新消息到达时将消息打印到控制台,即使它目前不会被服务处理(因为服务正在工作)在之前的通话中)。 这是基于我的假设,即到达的消息由 WCF 排队,这是正确的吗?

此外,如果这很重要,我会使用 netTcpBinding。

I'm writing a sample console service host and I want to plug into WCF stack to be able to print a message to console when new message arrives, even if it won't get processed by the service at the moment (because service is working on previous calls).
This is based on my assumption that messages arriving get queued by the WCF, is that correct?

Additionally, I'm using netTcpBinding if this is important.

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

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

发布评论

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

评论(2

那支青花 2024-07-13 17:06:14

您可以编写自定义通道并将其插入到通道堆栈中的任意位置。 排队发生在 ChannelListener 中,它位于每个通道之间:

ChannelListener_1 -> 频道_1 -> ChannelListener_2 ->; 频道_2 -> 因此

,如果您要插入自己的通道侦听器/通道,您可以挂钩到您需要的流程的任何部分。 但请注意,消息内容可能无法读取,直到消息内容进一步深入堆栈并被解密。

You could write a custom channel and insert it into the channel stack at whatever point you want. Queuing happens in ChannelListeners, which sit between each channel:

ChannelListener_1 -> Channel_1 -> ChannelListener_2 -> Channel_2 -> etc.

So, if you were to insert your own channel listener / channel you could hook into any part of the process you need to. Note however that the message contents might not be readable until it gets farther down the stack and gets decrypted.

幻梦 2024-07-13 17:06:14

您可能必须为此编写一个自定义通道。 查看WCF 频道迷你书

You probably have to write a custom channel for that. Check out WCF Channels Mini Book

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