"No message serializer has been configured" error when starting NServiceBus endpoint

Posted by SteveBering on Stack Overflow See other posts from Stack Overflow or by SteveBering
Published on 2010-05-07T16:27:58Z Indexed on 2010/05/11 0:14 UTC
Read the original article Hit count: 1148

Filed under:

My GenericHost hosted service is failing to start with the following message:

2010-05-07 09:13:47,406 [1] FATAL NServiceBus.Host.Internal.GenericHost [(null)] <(null)> - System.InvalidOperationException: No message serializer has been con figured. at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.CheckConfiguration() in d:\BuildAgent-02\work\672d81652eaca4e1\src\impl\unicast\NServiceBus.Unicast.Msmq\ MsmqTransport.cs:line 241 at NServiceBus.Unicast.Transport.Msmq.MsmqTransport.Start() in d:\BuildAgent-02\work\672d81652eaca4e1\src\impl\unicast\NServiceBus.Unicast.Msmq\MsmqTransport .cs:line 211 at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start(Action startupAction) in d:\BuildAgent-02\work\672d81652eaca4e1\src\unicast\NServiceBus.Uni cast\UnicastBus.cs:line 694 at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start() in d:\BuildAgent-02\work\672d81652eaca4e1\src\unicast\NServiceBus.Unicast\UnicastBus.cs:l ine 665 at NServiceBus.Host.Internal.GenericHost.Start() in d:\BuildAgent-02\work\672d81652eaca4e1\src\host\NServiceBus.Host\Internal\GenericHost.cs:line 77

My endpoint configuration looks like:

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();
    }
}

And my app.config looks like:

<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>

This has worked in the past, but seems to be failing when the generic host starts. My endpoint configuration is below, along with the app.config for the service. What is strange is that in my endpoint configuration, I am specifying to use the XmlSerializer for message serialization. I don't see any other errors in the console output preceding the error message. What am I missing?

Thanks, Steve

© Stack Overflow or respective owner

Related posts about nservicebus