Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9229409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:33:52+00:00 2026-06-18T05:33:52+00:00

I have two worker roles setup as nservicebus endpoints (nservicebus 3.2.8) and both use

  • 0

I have two worker roles setup as nservicebus endpoints (nservicebus 3.2.8) and both use AzureDataBus configurations for messages that are larger than the size allotted for azure queues. My employer does not allow placing credentials in the configuration so a IProvideConfiguration is used to configure the storage credentials.

This seems to work, however it appears that nservicebus is still trying to intialize the databus channel with a local development storage connection and this is causing the worker role to restart several times. Eventually it starts and picks up the correct configuration.

Am i doing something incorrect in regards to how i should be configuring the databus channel?

Here is the exception from the worker role’s event log:

An unhandled exception occurred. Type: System.Exception Process ID: 2420
Process Name: WaWorkerHost
Thread ID: 6
AppDomain Unhandled Exception for role My.WorkerRole.Assembly_IN_1
Exception: Exception when starting endpoint, error has been logged. Reason: Unable to connect to the remote server
   at NServiceBus.Hosting.GenericHost.Start()
   at NServiceBus.Hosting.Azure.RoleEntryPoint.Run()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<StartRole>b__1()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Inner Exception: Unable to connect to the remote server
   at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
   at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
   at Microsoft.WindowsAzure.StorageClient.CloudBlobContainer.CreateIfNotExist(BlobRequestOptions options)
   at NServiceBus.DataBus.Azure.BlobStorage.BlobStorageDataBus.Start()
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at NServiceBus.Unicast.UnicastBus.NServiceBus.IStartableBus.Start(Action startupAction)
   at NServiceBus.Hosting.GenericHost.Start()

Inner Exception: No connection could be made because the target machine actively refused it 127.0.0.1:10000
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

Which promptly causes a process termination:

Application: WaWorkerHost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Exception
Stack:
   at NServiceBus.Hosting.GenericHost.Start()
   at NServiceBus.Hosting.Azure.RoleEntryPoint.Run()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal()
   at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.<StartRole>b__1()
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

Here is my EndPoint Configuration:

internal class EndpointConfig : IConfigureThisEndpoint, AsA_Worker, IWantCustomInitialization
    {
        #region IWantCustomInitialization Members

        public void Init()
        {
            Configure.With()
                     .DefaultBuilder()
                     .AzureConfigurationSource()
                     .MessageForwardingInCaseOfFault()
                     .AzureMessageQueue()
                     .JsonSerializer()
                     .AzureDataBus()
                     .AzureSubcriptionStorage()
                     .UnicastBus()
                     .DisableTimeoutManager()
                     .DisableSecondLevelRetries()
                     .IsTransactional(true)
                     .IsolationLevel(System.Transactions.IsolationLevel.ReadCommitted)
                     .PurgeOnStartup(false);
            }
}

Databus configuration override:

 public class ConfigOverride : IProvideConfiguration<AzureDataBusConfig>
    {

        AzureDataBusConfig IProvideConfiguration<AzureDataBusConfig>.GetConfiguration()
        {
            return new AzureDataBusConfig()
            {
                ConnectionString = "my storage key";
            };
        } 

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:33:53+00:00Added an answer on June 18, 2026 at 5:33 am

    Sounds like a timing problem in the initialization logic, basically you invoke AzureDataBus() before you config override is applied by nsb and you fall back to the default settings. Can you try putting the IWantCustomInitialization in a separate class (than it will run a bit later).

    If this does not help, feel free to send me a small repro and I’ll have a look at it!

    PS: You can omit .With().DefaultBuilder() as that is the default anyway!

    Kind regards,
    Yves

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two string variables which are both file paths. The code that worked
As an example, I have a hosted service with two roles, web and worker.
OS is Linux, working with pthreads I have two worker threads that run forever,
in my service deployment i have two roles.. a web role and a worker
My problem is this: I have two threads, my UI thread, and a worker
I have two kinds of users: Admin and Worker. each user has role_ids: if
I have two web applications, both to be hosted on Heroku. One is the
I have two worker threads: DB thread Network thread They would be singletons so
I have a database that has two tables, one of which contains a foreign
I have two threads main thread and worker thread. What I want to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.