Nservicebus 和 S#arp 架构
我正在尝试将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一件事可能是您从控制器使用 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.
就其本身而言, 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.