Here is the error I get in my log file once I execute Bus.Reply():
System.InvalidOperationException: Reply is neither supported for Commands nor Events. Commands should be sent to their logical owner using bus.Send and bus. Events should be Published with bus.Publish.
I have a DotNet WCF Service that I have configured using Global.asax as follows in the code below:
I am making a call from a Host Service DLL with a Bus.Sends(Message) On the WCF Service I am calling Bus.Reply(responseMessage)
I want this to be full duplex so that I can do a callback to the client when completed, but I can not seem to get the configuration correct. I have loaded NServiceBus -version 4.4.2 Only, like you would configure a Web Service. The examples I have seen that do full duplex load NServiceBus.Host, but that seems wrong, while running under IIS???
What am I missing?
Thanks in Advance :)
namespace MapQuest.Service
{
using log4net;
using NServiceBus;
using NServiceBus.Installation.Environments;
using System.IO;
using System.Web;
public class ServiceBus
{
public static IBus Bus { get; private set; }
public static ILog Log { get; private set; }
public static void Init()
{
if (Bus != null)
return;
lock (typeof(ServiceBus))
{
if (Bus != null)
return;
Bus = Configure.With()
.Log4Net()
.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.EndsWith("Commands")
&& t.Namespace.StartsWith("Regions"))
.DefiningEventsAs(t => t.Namespace != null && t.Namespace.EndsWith("Events")
&& t.Namespace.StartsWith("Regions"))
.DefiningMessagesAs(t => t.Namespace != null && t.Namespace.EndsWith("Messages")
&& t.Namespace.StartsWith("Regions"))
.DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted"))
.DefineEndpointName("MapQuest.Service")
.DefaultBuilder()
.UseTransport<Msmq>()
.PurgeOnStartup(true)
.UnicastBus()
.LoadMessageHandlers()
.CreateBus()
.Start();
log4net.Config.XmlConfigurator.Configure();
Log = LogManager.GetLogger(typeof(ServiceBus));
}
}
}
}