Nservicebus 和 S#arp 架构

发布于 2024-08-20 21:15:10 字数 612 浏览 1 评论 0原文

我正在尝试将 S#arp 架构与 NServicebus 集成,但遇到一些错误。

有人已经一起使用过这两个项目吗?有这方面的例子吗?

Ibus 似乎已正确实例化,但当我调用 bus.Send(message) 时,我收到此错误。

System.NullReferenceException: Object reference not set to an instance of an object.

在 d:\BuildAgent-03\work\672d81652eaca4e1\src\unicast\NServiceBus.Unicast\MessageContext.cs 中的 NServiceBus.Unicast.MessageContext..ctor(TransportMessage TransportMessage) 处:第 21 行 在 d:\BuildAgent-03\work\672d81652eaca4e1\src\unicast\NServiceBus.Unicast\UnicastBus.cs 中的 NServiceBus.Unicast.UnicastBus.NServiceBus.IBus.get_CurrentMessageContext() 处:第 787 行

I am trying to integrate S#arp Architecture with NServicebus but I am getting some errors.

Anyone already used both projects together? Any examples about that?

The Ibus seems to be correctly instantiated but I am getting this error when I call the bus.Send(message).

System.NullReferenceException: Object reference not set to an instance of an object.

at NServiceBus.Unicast.MessageContext..ctor(TransportMessage transportMessage) in d:\BuildAgent-03\work\672d81652eaca4e1\src\unicast\NServiceBus.Unicast\MessageContext.cs: line 21
at NServiceBus.Unicast.UnicastBus.NServiceBus.IBus.get_CurrentMessageContext() in d:\BuildAgent-03\work\672d81652eaca4e1\src\unicast\NServiceBus.Unicast\UnicastBus.cs: line 787

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

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

发布评论

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

评论(2

扎心 2024-08-27 21:15:10

另一件事可能是您从控制器使用 RegisterWebCallback 而不将页面作为显式参数传递。 NServiceBus 尝试将回调函数的目标转换为 System.Web.Page,这可能会变成 null(这已在版本 2.0 的最新版本中被捕获为显式异常)。

希望有帮助。

Another thing that it might be is that you're using RegisterWebCallback from your controller without passing in the page as an explicit parameter. NServiceBus tries to cast the target of the callback function to System.Web.Page and it could be that that is what becomes null (this has been captured as an explicit exception in more recent builds of version 2.0).

Hope that helps.

深爱不及久伴 2024-08-27 21:15:10

就其本身而言, Bus.Send(message) 不会访问 Bus.CurrentMessageContext,这似乎是导致您的问题的原因。尝试从代码中删除对 Bus.CurrentMessageContext 的调用,看看是否可以解决您的问题。

By itself, Bus.Send(message) doesn't access Bus.CurrentMessageContext, which appears to be what is causing your problem. Try removing the call to Bus.CurrentMessageContext from your code and see if that solves your problem.

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