在没有 NServceBus.Host.exe 的情况下托管 NServiceBus 时出现 ComponentActivatorException

发布于 2024-09-15 09:09:04 字数 1619 浏览 4 评论 0原文

我想在我自己的进程中托管 NServiceBus。

配置 NServiceBus 时出现空引用异常,我更改了一些配置调用的顺序,这似乎解决了该问题。我现在面临另一个错误。这是我的配置代码:

Configure.With()
                .CastleWindsorBuilder(Container.Instance)
                .XmlSerializer()
                .MsmqSubscriptionStorage()
                .MsmqTransport()
                .UnicastBus()
                .LoadMessageHandlers()
                .CreateBus()
                .Start();

这是堆栈跟踪:

Exception

Castle.MicroKernel.ComponentActivator.ComponentActivatorException

在类型 NServiceBus.Serializers.XML.MessageSerializer 上设置属性 set_MessageTypes 时出错,组件 ID 为 NServiceBus.Serializers.XML.MessageSerializer。有关详细信息,请参阅内部异常。

内部异常详细信息:

System.BadImageFormatException

“尝试加载程序 格式不正确。 (例外 来自 HRESULT:0x8007000B)"

   at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateType()
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.CreateTypeFrom(Type t, ModuleBuilder moduleBuilder)
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.InitType(Type t, ModuleBuilder moduleBuilder)
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.Initialize(IEnumerable`1 types)
   at NServiceBus.Serializers.XML.MessageSerializer.set_MessageTypes(List`1 value)

I want to host NServiceBus inside my own process.

I was getting a null reference exception when configuring NServiceBus, I changed the order of some of the configure calls which seemed to resolve that. I am now faced with another error. This is the configuration code I have:

Configure.With()
                .CastleWindsorBuilder(Container.Instance)
                .XmlSerializer()
                .MsmqSubscriptionStorage()
                .MsmqTransport()
                .UnicastBus()
                .LoadMessageHandlers()
                .CreateBus()
                .Start();

Here is the stack trace:

Exception

Castle.MicroKernel.ComponentActivator.ComponentActivatorException

Error setting property set_MessageTypes on type NServiceBus.Serializers.XML.MessageSerializer, Component id is NServiceBus.Serializers.XML.MessageSerializer. See inner exception for more information.

Inner Exception Detail:

System.BadImageFormatException

"An attempt was made to load a program
with an incorrect format. (Exception
from HRESULT: 0x8007000B)"

   at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateType()
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.CreateTypeFrom(Type t, ModuleBuilder moduleBuilder)
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.InitType(Type t, ModuleBuilder moduleBuilder)
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.Initialize(IEnumerable`1 types)
   at NServiceBus.Serializers.XML.MessageSerializer.set_MessageTypes(List`1 value)

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

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

发布评论

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

评论(1

乙白 2024-09-22 09:09:04

可能是在部署到运行时目录的程序集之一中,您的消息类型引用了某些其他类型,而这些类型无法加载,因为它是在错误的平台上编译的。

It could be that in one of the assemblies deployed to your runtime directory you have message types which reference some other type which could not be loaded as it was compiled on the wrong platform.

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