Search code examples
servicebus

Microsoft Service Bus 1.0 unable to communicate with a server outside the client's domain


I have installed Service Bus 1.0 on a server joined to a Domain.

From a client app running on a PC joined on the same domain, I am able to create queues, messages, etc. I use a connection string specifying credentials of a user on the same domain. Everything works.

From a client app running on a PC outside the domain, nothing works. I was thinking it was related to the fact that it was not possible to use a user from the server domain if the client app was not on the same domain, so I also try to use a connection string containing a SharedSecretIssuer and a ShareSecretValue. With this approach I got:

The token provider service was not avaliable when obtaining a token for 'https://servicebus01.dns1.XXXXXX.com:9355/XXXXXServiceBus/WRAPv0.9/'. Innner exception contains "The remote server returned an error: (404) Not Found.".

Anyone knows if it is possible to communicate with a Service Bus server outside the domain of this server?


Solution

  • Alternatively, even if your client is not joined to the domain, you can use the OAuthTokenProvider.

    Once you have created your namespace manager and factory and before doing any operation:

    namespaceManager.Settings.TokenProvider = TokenProvider.CreateOAuthTokenProvider(new Uri[] { new Uri("https://servicebus01.dns1.XXXXXX.com:9355") }, new NetworkCredential("user", "password", "domain"))

    messagingFactory.GetSettings().TokenProvider = TokenProvider.CreateOAuthTokenProvider(new Uri[] { new Uri("https://servicebus01.dns1.XXXXXX.com:9355")}, new NetworkCredential("user", "password", "domain"));