问题
I am developing my first Azure implementation, I have set up my azure account and i used NuGet to install The proper DLL's and configs to my application. when i set my WCF client to point to the Service Bus Queue and run the method i get this exception:
Microsoft.ServiceBus.ServerErrorException
at Microsoft.ServiceBus.RelayedSocketInitiator.Connect(Uri uri, TimeSpan timeout)
at Microsoft.ServiceBus.ConnectivityModeConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at Microsoft.ServiceBus.Channels.BufferedConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at Microsoft.ServiceBus.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at Microsoft.ServiceBus.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at Microsoft.ServiceBus.Channels.LayeredChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
my endpoint config is:
<endpoint address="sb://MyService.servicebus.windows.net/MyServicequeue"
binding="netTcpRelayBinding" contract="PaperlessImportServiceWCF.PaperlessImportServiceSoap"
name="MyServiceServiceSoap" behaviorConfiguration="sbTokenProvider"/>
My endpoint
Behavior is:
The Error message is very generic and I am not sure what the is first place I should look
回答1:
I think you have a few misunderstandings about how the relay service works. From the configuration you show, you're using the NetTcpRelayBinding, which is meant for request-replay connectivity. However, in your endpoint, it seems like you're using a queue address as an endpoint.
a) If you meant to use your service/client in a request-reply fashion, then you need to create a service bus relay endpoint, and use that address in your endpoint. This tutorial is a good starting point for this servicebus feature.
b) If you meant to use the queue, then you need to the NetMessagingBinding. This post is a good starting point on how to perform said scenario.
In either case, it also seems like you're using the wrong base address. Is 'myservice' the name of your servicebus namespace? If it's not, then you should replace it with the name of your namespace. The format of a base servicebus address is: protocol://YOUR_NAMESPACE.servicebus.windows.net
来源:https://stackoverflow.com/questions/14781639/connecting-to-azure-servicebus-queue