When using SendFailedMessagesTo() it instructs to send messages failed processing to the error queue. SendOnly() sets up a send-only endpoint. Those two mixed together are conflicting.
System.Exception was unhandled
Message: An unhandled exception of type ‘System.Exception’ occurred in mscorlib.dll
Additional information: Faults forwarding requires an error queue to be specified using ‘EndpointConfiguration.SendFailedMessagesTo()’.
I have downgraded the NServiceBus from 6.4.3 to 6.0.0. Still I am receiving this error message. I am using AzureStoragePersistence
An unhandled exception of type ‘System.Exception’ occurred in mscorlib.dll
Additional information: No persistence has been selected, select a persistence by calling endpointConfiguration.UsePersistence() in the class that implements either IConfigureThisEndpoint or INeedInitialization, where T can be any of the supported persistence option. If previously using RavenDB, note that it has been moved to its own stand alone nuget ‘NServiceBus.RavenDB’. This package will need to be installed and then enabled by calling endpointConfiguration.UsePersistence().
Ok, this is now a different exception. Since ASQ doesn’t have native timeouts in the version you are using you need to configure timeout storage using:
Still I am receiving the error after updating with the version you have mentioned.
I am running it through NServiceBusHost. and version=“7.0.0” targetFramework=“net46”.
Below is the error message I am receiving.
2017-12-13 15:46:47.622 FATAL NServiceBus.GenericHost Exception when starting endpoint. System.Exception: Faults forwarding requires an error queue to be specified using 'EndpointConfiguration.SendFailedMessagesTo()'
at NServiceBus.MsmqTransport.Initialize(SettingsHolder settings, String connectionString) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Transports\Msmq\MsmqTransport.cs:line 37 at NServiceBus.InitializableEndpoint.d__1.MoveNext() in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\InitializableEndpoint.cs:line 49
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NServiceBus.GenericHost.d__1.MoveNext() in C:\Build\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 48
There are a few things that I don’t understand, it seems to me that what you run is not the code you posted above, or there is some mixup going on.
The code above is using the self hosting technique, while the stacktrace shows that you are using the generic hosting model.
The code you showed also specifies that the transport in use is the azure storage queues transport, while the stacktrace says it is the msmq transport.
Can you share your project?
Here is the console application that I used for testing
You are mixing 2 hosting models, you effectively have 2 endpoints running, 1 on msmq and another on azure storage queues.
I think you want to customize the endpoint configuration provided by the generic host instead of creating a new one manually, like this:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
public void Customize(EndpointConfiguration configuration)
{
var sourceQueue = "Queue";
var storageConnectionString = "ConnectionString";
configuration.DefineEndpointName(sourceQueue);
var persistence = configuration.UsePersistence<AzureStoragePersistence>();
persistence.ConnectionString(storageConnectionString);
configuration.UsePersistence<AzureStoragePersistence, StorageType.Sagas>().AssumeSecondaryIndicesExist();
configuration.UsePersistence<AzureStoragePersistence, StorageType.Subscriptions>();
configuration.UseSerialization<JsonSerializer>();
configuration.EnableInstallers();
configuration.SendFailedMessagesTo("error");
var transport = configuration.UseTransport<AzureStorageQueueTransport>();
transport.ConnectionString(storageConnectionString);
}
}
Note: I also removed the timeout manager configuration, this version of the storage queues transport has native delayed delivery, so you don’t need it.