The message is queued in Azure, and I am trying to fetch it at the worker/handler method for further processing. Currently we are using 5.0.0.0 version of NServiceBus.Core.
The EndpointConfig file in the NSB Worker comprises of -
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
{
public void Customize(BusConfiguration configuration)
{
NServiceBus.Logging.LogManager.Use<NLogFactory>();
OptimizeForAzure();
var endPointName = ConfigurationManager.AppSettings["DCIMGNSBUpdateEndPoint"];
configuration.EndpointName(endPointName);
configuration.OverrideLocalAddress(endPointName);
configuration.AssembliesToScan(AllAssemblies.Matching("NServiceBus").And("DC.IMG.NSBUpdate"));
configuration.DoNotCreateQueues();
configuration.Conventions().DefiningCommandsAs(type => type.GetCustomAttributes(true).Any(t => t.GetType().Name == "CommandAttribute"));
configuration.UseTransport<AzureStorageQueueTransport>();
configuration.UsePersistence<InMemoryPersistence>();
}
public void OptimizeForAzure()
{
ServicePointManager.DefaultConnectionLimit = 1000;
ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.Expect100Continue = false;
}
}
The following exception is thrown at the execution cycle, at the end of Customize method -
System.TypeInitializationException was unhandled
Message: An unhandled exception of type 'System.TypeInitializationException' occurred in mscorlib.dll
Additional information: The type initializer for 'NServiceBus.Persistence.PersistenceStartup' threw an exception.
Any hints at resolution of this issue. Is it due to version mismatch of any specific packages, or end point configuration mismatch.