我的 GenericHost 托管服务无法启动并显示以下消息:
2010-05-07 09:13:47,406 [1] FATAL NServiceBus.Host.Internal.GenericHost [(null)] <(null)> - System.InvalidOperationException:未配置消息序列化程序。在 NServiceBus.Unicast.Transport.Msmq.MsmqTransport.CheckConfiguration() 在 d:\BuildAgent-02\work\672d81652eaca4e1\src\impl\unicast\NServiceBus.Unicast.Msmq\ MsmqTransport.cs:line 241 在 NServiceBus.Unicast.Transport .Msmq.MsmqTransport.Start() 在 d:\BuildAgent-02\work\672d81652eaca4e1\src\impl\unicast\NServiceBus.Unicast.Msmq\MsmqTransport .cs:line 211 在 NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start (Action startupAction) in d:\BuildAgent-02\work\672d81652eaca4e1\src\unicast\NServiceBus.Uni cast\UnicastBus.cs: d 中 NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start() 的第 694 行:
我的端点配置如下所示:
public class ServiceEndpointConfiguration
: IConfigureThisEndpoint, AsA_Publisher, IWantCustomInitialization
{
public void Init()
{
// build out persistence infrastructure
var sessionFactory = Bootstrapper.InitializePersistence();
// configure NServiceBus infrastructure
var container = Bootstrapper.BuildDependencies(sessionFactory);
// set up logging
log4net.Config.XmlConfigurator.Configure();
Configure.With()
.Log4Net()
.UnityBuilder(container)
.XmlSerializer();
}
}
我的 app.config 看起来像:
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="Logging" type="NServiceBus.Config.Logging, NServiceBus.Core" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false" />
</configSections>
<Logging Threshold="DEBUG" />
<MsmqTransportConfig
InputQueue="NServiceBus.ServiceInput"
ErrorQueue="NServiceBus.Errors"
NumberOfWorkerThreads="1"
MaxRetries="2" />
<UnicastBusConfig
DistributorControlAddress=""
DistributorDataAddress=""
ForwardReceivedMessagesTo="NServiceBus.Auditing">
<MessageEndpointMappings>
<!-- publishers don't need to set this for their own message types -->
</MessageEndpointMappings>
</UnicastBusConfig>
<connectionStrings>
<add name="Db" connectionString="Data Source=..." providerName="System.Data.SqlClient" />
</connectionStrings>
<log4net debug="true">
<root>
<level value="INFO"/>
</root>
<logger name="NHibernate">
<level value="ERROR" />
</logger>
</log4net>
这在过去有效,但在通用主机启动时似乎失败了。下面是我的端点配置以及服务的 app.config。奇怪的是,在我的端点配置中,我指定使用 XmlSerializer 进行消息序列化。我在错误消息之前的控制台输出中看不到任何其他错误。我错过了什么?
谢谢,史蒂夫