wcf - Azure 服务总线中继响应缓慢

标签 wcf azure azureservicebus

我有一个托管在 Azure 中的 Azure 服务总线中继,它公开了类似于以下端点的端点: https://myTestSB.servicebus.windows.net/MyService/LogIn()

有趣的是,当我调用此服务总线时,它会进行 4 次调用,如下所示。 这是导致响应缓慢的原因。

有人可以吗 澄清发生了什么 每次通话时?第一个调用 #1 是否必须等待 2、3 和 4?

1(需要很长时间)

GET https://myTestSB.servicebus.windows.net/MyService/LogIn()?$filter=UserID eq '1234' and Password eq 'secret'
User-Agent: Microsoft ADO.NET Data Services
.....
Status Code: OK 200
...

2

CONNECT https://myTest-sb.accesscontrol.windows.net/WRAPv0.9/

Status Code: OK 200
Connection: Keep-Alive
Proxy-Connection: Keep-Alive

3

POST https://TestSB-sb.accesscontrol.windows.net/WRAPv0.9/
Content-Type: application/x-www-form-urlencoded
Host: TestSB-sb.accesscontrol.windows.net
Content-Length: 307
Expect: 100-continue
Connection: Keep-Alive

Status Code: OK 200
.......

4

CONNECT https://myTestSB.servicebus.windows.net/MyService/LogIn()?$filter=UserID eq '1234' and Password eq 'secret'

Status Code: OK 200
Connection: Keep-Alive
Proxy-Connection: Keep-Alive

登录服务总线需要 5-10 秒,而在本地环境中只需不到一秒。不确定服务总线为何以及如何增加延迟。

最佳答案

默认情况下,Azure 服务总线中继通常通过 ACS 使用选择加入身份验证 ( Access Control Services )。为了使用中继端点 - 它必须首先使用 ACS token 授权 WCF channel 。如果您选择不使用 ACS you are providing your own relay access control,则可以通过配置删除您看到的额外调用。 。

禁用 ACS 进行服务总线中继(选择退出)

<bindings>
  <netTcpRelayBinding>
    <binding name="default">
      <security relayClientAuthenticationType="None" />
    </binding>
  </netTcpRelayBinding>
</bindings>

更多详情,请参阅 MSDN on securing Azure Service Bus Connections .

至于延迟问题(5-10 秒) - 这一切都取决于使用的 WCF 调用数量、您与数据中心的关系以及共享的数据量。有许多选项可以调整上述所有内容。另外ensure you have configured your firewall properly for establishing Azure Relay communication .

关于wcf - Azure 服务总线中继响应缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17987846/

相关文章:

c# - Windows Azure MessageLockLostException

.net - 为什么 maxConcurrentSessions 默认为这么低的值?什么是安全值?

azure - git 部署到 Azure 网站已停止工作

azure - 新的 Azure 服务总线库可以与之前的服务总线库一起使用吗?

c# - Azure函数-队列触发器批量而不是逐项处理

database - 如何使用 sqlplus 或 sql Developer 云连接连接到 Azure Oracle 12c 数据库

c# - 在 C# 中,是否可以模拟出 IMessageReceiver 和相关类进行单元测试?

c# - 工作流/工作流服务组合?如何在 'normal' 工作流上使用 Receive 事件?

存在名称参数时未选择 WCF endpointBehaviors 扩展?

c# - 将 WinForm 应用程序限制为具有多个实例的一个进程