I'm trying to develop a Windows Service that will consume a queue using a listener.
This works fine if I set this up as a console application with the Console.Writeline in bold below.
If I remove this i will not run.

Does some on have an example of how to write a Windows Server using Listeners or help with this issue?

Simple Listener method.

public static void StartListener()
{
string URI = "tcp://192.168.76.100:61616";
string DESTINATION = "oracle.queue";

try
{
ConnectionFactory connectionFactory = new ConnectionFactory(URI);

using (SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer())
{
listenerContainer.ConnectionFactory = connectionFactory;
listenerContainer.DestinationName = DESTINATION;
listenerContainer.MessageListener = new Listener();
listenerContainer.AfterPropertiesSet();
_logger.Trace("Listener started.");
Console.ReadKey();
}
}
catch (Exception ex)
{
_logger.Trace(ex);
}
}