0

I am currently writing a couple .NET core of applications using NServiceBus with AzureServiceBusTransport, but I cannot find any way of configuring it with a WebProxy. When using Azure Servicebus directly we have the configuration option available on ServiceBusClientOptions, but I can't find any such property or method on AzureServiceBusTransport.

I've found some threads suggesting that it is possible to set default proxy, but I'm not sure if that is something we want to do as we're doing calls that does not require proxy in the same application(s).

Is there any way to configure a WebProxy when using NServiceBus + Azure ServiceBus?

davide
  • 1
  • 1
  • Are you configuring your transport to use WebSockets? – Sean Feldman Apr 19 '22 at 16:41
  • You can refer to [HTTP proxy support in .NET Core/Standard](https://github.com/Azure/azure-service-bus-dotnet/issues/436#issuecomment-377601501), [how to set a custom WebProxy in QueueClient and/or ServiceBusConnection using Microsoft.Azure.ServiceBus SDK](https://github.com/Azure/azure-sdk-for-net/issues/13040) and [NService Bus. NETCore and Proxy PROBLEM](https://discuss.particular.net/t/nservice-bus-netcore-and-proxy-problem/855) – Ecstasy Apr 20 '22 at 07:18
  • @SeanFeldman yes, we've enabled WebSockets using `transport.UseWebSockets()` @DeepDave-MT both of the links are about `WebRequest.DefaultWebProxy`, but I was hoping I'd be able to somehow set the proxy configuration to only apply to the servicebusclient under the hood, not all httpclients / requests in the application. I might be misunderstanding something though. I see it is possible to pass an argument for uris that should buypass the proxy and that could be a solution, but that would require the application to know what is internal as separate configuration. – davide Apr 20 '22 at 07:47
  • The current transport is not using Microsoft.Azure.ServiceBus but rather Azure.Messaging.ServiceBus. The latter has a stricter approach to connection strings. I suggest you ask on the client SDK issue tracker if it’s possible to specify proxy details via connection string at all. – Sean Feldman Apr 20 '22 at 13:09
  • This seems like a shortcoming of the NServiceBus transport implementation for Azure Service Bus, I have raised a feature request to track adding the ability to specify the WebProxy, see https://github.com/Particular/NServiceBus.Transport.AzureServiceBus/issues/531 for more details – Andreas Öhlund Apr 21 '22 at 13:06

0 Answers0