2

我正在开发我的第一个 Azure 实现,我已经设置了我的 azure 帐户,并使用 NuGet 将正确的 DLL 和配置安装到我的应用程序中。当我将 WCF 客户端设置为指向服务总线队列并运行该方法时,我得到了这个异常:

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)

我的端点配置是:

<endpoint address="sb://MyService.servicebus.windows.net/MyServicequeue"
                binding="netTcpRelayBinding" contract="PaperlessImportServiceWCF.PaperlessImportServiceSoap"
                name="MyServiceServiceSoap"  behaviorConfiguration="sbTokenProvider"/>

我的endpoint行为是:

错误消息非常通用,我不确定我应该看什么

4

1 回答 1

2

我认为您对中继服务的工作方式有一些误解。从您显示的配置中,您使用的是 NetTcpRelayBinding,它用于请求重放连接。但是,在您的端点中,您似乎正在使用队列地址作为端点。

a) 如果您打算以请求-回复方式使用您的服务/客户端,那么您需要创建一个服务总线中继端点,并在您的端点中使用该地址。本教程是此服务总线功能的一个很好的起点。

b) 如果您打算使用队列,那么您需要使用 NetMessagingBinding。这篇文章是关于如何执行上述场景的一个很好的起点。

无论哪种情况,您似乎都使用了错误的基地址。'myservice' 是您的服务总线命名空间的名称吗?如果不是,那么您应该将其替换为您的命名空间的名称。基本服务总线地址的格式为:protocol://YOUR_NAMESPACE.servicebus.windows.net

于 2013-02-09T00:34:53.810 回答