Search code examples
nservicebus

NServiceBus - Exception when starting endpoint. Value cannot be null. Parameter name: endpoint


I’m using NServiceBus 6.4.3 with RabbitMQ transport 4.4.5

I’m getting this exception when trying to run my project:

FATAL: NServiceBus.Logging.NLog.Logger.Fatal - Exception when starting endpoint. System.ArgumentNullException: Value cannot be null.
    Parameter name: endpoint
       at NServiceBus.Receiving.<>c.<.ctor>b__0_1(SettingsHolder s) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Transports\Receiving.cs:line 17
       at NServiceBus.Features.Feature.ConfigureDefaults(SettingsHolder settings) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Features\Feature.cs:line 213
       at NServiceBus.Features.FeatureActivator.SetupFeatures(IConfigureComponents container, PipelineSettings pipelineSettings, RoutingComponent routing) in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\Features\FeatureActivator.cs:line 53
       at NServiceBus.InitializableEndpoint.<Initialize>d__1.MoveNext() in C:\BuildAgent\work\a93f853f0c1b9532\src\NServiceBus.Core\InitializableEndpoint.cs:line 60
    --- 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.<Start>d__1.MoveNext() in C:\Build\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 48

I have no idea where to start investigating for this error.


Solution

  • I'm only answering this question so that if anyone else happens to stumble upon this error so that you won't waste time figuring out what this means.

    I mistakenly had this call in my EndpointConfig.cs:

    endpointConfiguration.DefineEndpointName(ConfigurationManager.AppSettings["EndpointName"]);
    

    and I didn't have a key in my app.config for that EndpointName. In my case, I just removed this call to DefineEndpointName because it was mistakenly added, but if you do need to define a name for your endpoint just make sure you have it correctly.