Windows Azure PHP队列REST代理限制

时间:2014-09-10 10:19:03

标签: php azure azure-queues

我正在编写一个使用Azure PHP SDK从Windows Azure Queue Storage出队的作业处理器。该作业只是尝试批量获取32条消息,处理它们,然后从队列中删除消息,并重复这些步骤。但是,每次运行PHP脚本时,下面的错误都是在循环运行了27次之后抛出:

PHP Fatal error:  Uncaught HTTP_Request2_MessageException: Malformed response:  in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 1013
#0 /usr/share/php/HTTP/Request2/Adapter/Socket.php(1013): HTTP_Request2_Response->__construct('', true, Object(Net_URL2))
#1 /usr/share/php/HTTP/Request2/Adapter/Socket.php(136): HTTP_Request2_Adapter_Socket->readResponse()
#2 /usr/share/php/HTTP/Request2.php(939): HTTP_Request2_Adapter_Socket->sendRequest(Object(HTTP_Request2))
#3 /usr/share/php/WindowsAzure/Common/Internal/Http/HttpClient.php(262): HTTP_Request2->send()
#4 /usr/share/php/WindowsAzure/Common/Internal/RestProxy.php(141): WindowsAzure\Common\Internal\Http\HttpClient->send(Array, Object(WindowsAzure\Common\Internal\Http\Url))
#5 /usr/share/php/WindowsAzure/Common/Internal/ServiceRestProxy.php(86): WindowsAzure\Common\Internal\RestProxy->sendContext(Object(WindowsAzure\Common\Internal\Http\HttpCallContext))
#6 /usr/share/php/WindowsAzure/Common/Internal/ServiceRestProxy.php(125): WindowsAzure\Common\Internal\ServiceRestPr in /usr/share/php/HTTP/Request2/Response.php on line 215

任何Azure专家都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

为了绕过Azure存储操作上的HTTPS连接限制(包括存储查询,或者说blob blob chunked upload),您需要将azure blob服务连接字符串设置为http。

您可以执行以下操作(在执行多操作调用之前传入false):

function getBlobStorageProxy($secure = true) {
    if ($secure) {
      $connectionString = "DefaultEndpointsProtocol=https;AccountName=[AccountName];AccountKey=[AccountKey]";
    } else {
      $connectionString = "DefaultEndpointsProtocol=http;AccountName=[AccountName];AccountKey=[AccountKey]";
    }

    $this->serviceBuilder = ServicesBuilder::getInstance();
    return $this->serviceBuilder->createBlobService($connectionString);
}