Particular / NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
https://particular.net/nservicebus/
Other
2.07k stars 647 forks source link

Azure onprem behind corporate proxy doesn't seem to work. #2163

Closed shaunmarx closed 10 years ago

shaunmarx commented 10 years ago

I am trying to get a very simple POC working, but for the life of me can't seem to get a NServiceBus (version 4.0.30319) service hosted on premise to connect to azure service bus hosted in the cloud. I am in a corporate environment behind a firewall and going via a proxy server and have the following configuration and code:

App.Config

<configSections>
    ...
    <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <section name="AuditConfig" type="NServiceBus.Config.AuditConfig, NServiceBus.Core" />
    <section name="AzureServiceBusQueueConfig" type="NServiceBus.Config.AzureServiceBusQueueConfig, NServiceBus.Azure.Transports.WindowsAzureServiceBus" />
    ...
</configSections>
...
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />

<AuditConfig QueueName="audit" />

<UnicastBusConfig>
    <MessageEndpointMappings />
</UnicastBusConfig>

<AzureServiceBusQueueConfig
  ConnectionString="Endpoint=sb://<my_host>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<my_shared_key>"
  ConnectivityMode="Http"
/>
...
<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true">
        <proxy bypassonlocal="True" usesystemdefault="True" />
    </defaultProxy>
</system.net>

EndpointConfig.cs

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, UsingTransport<AzureServiceBus>
{

}

The host starts up and works just fine when there is no proxy involved, but as soon as I try and run the host in an environment which contains a proxy it stops working. I should mention that using the Azure Service Bus directly does work, so not too sure why this would be the case. For obvious reasons I would like to use NServiceBus though :).

I did try to use fiddler to try and determine what is going on, but by throwing fiddler into the mix caused the exact same symptoms as what we were experiencing when using our corporate proxy. I can produce some wireshark logs if required, just not sure where to upload these or send them.

yvesgoeleven commented 10 years ago

You can send the logs to yves.goeleven@particular.net, I don't have an environment with proxy available so it's going to be hard to reproduce. Can you also send me the azure servicebus native test you used so that I can do a comparison, maybe some default settings are different

shaunmarx commented 10 years ago

Hi Yves, it would appear that this might actually not be an issue with NServiceBus at all. I tried the azure service bus directly on another machine just to double check and it turns out that it doesn't work on any other machine other than mine either, so same result as NServiceBus!

I did a bit of snooping around and realized that the authentication proxy on my machine (http://cntlm.sourceforge.net/) caused the inconsistent result. At least everything is consistently not working now :smile:. We would most likely not be using azure service bus directly from on-premise anyway, so I don't think it should be much of an issue considering I can get all the examples working in our development environment without the proxy :smile:

Really sorry for raising the issue! I should have double checked!

yvesgoeleven commented 10 years ago

No issue, good to hear you figured it out