1

我正在编写一个作业处理器,以使用 Azure PHP SDK 从 Windows Azure 队列存储中出列。该作业只是尝试批量获取 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 专家都可以帮助我吗?

4

1 回答 1

0

为了绕过 Azure 存储操作(包括存储查询,或者说块 blob 分块上传)上的 HTTPS 连接限制,您需要将 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);
}
于 2014-11-08T21:13:54.167 回答