【问题标题】:Php Eclipse on windows azure using cloud storage in local testing在本地测试中使用云存储在 windows azure 上的 PHP Eclipse
【发布时间】:2010-11-09 18:25:07
【问题描述】:

在开发结构中运行角色时,我一直在尝试访问云上的队列。为此,我按照以下步骤操作:

项目->属性->Windows Azure->数据存储,然后我选择了适当的字段并输入了我的凭据。

然后我执行以下操作:

require_once 'Microsoft/WindowsAzure/Storage/Queue.php';

$storageClient = new Microsoft_WindowsAzure_Storage_Queue();
if( !($storageClient->queueExists('worktodo'))){
 $result=$storageClient->createQueue('worktodo');
 echo 'Created queue: ' . $result->Name."<br/>";
}else{
 echo 'worktodo queue exists'."<br/>";
}



$storageClient->putMessage('worktodo', $id.','.$name, 3600); // 3600 = time-to-live of the message, if omitted defaults to 7 days
echo($storageClient->getAccountName());

长话短说,队列总是在 DevStorage 中创建......我的配置设置:

<ConfigurationSettings>
  <Setting name="StorageAccountName" value="myaccoutnt/>
  <Setting name="StorageAccountKey" value="mykey"/>
  <Setting name="SqlAzureHost" value=""/>
  <Setting name="SqlAzureUserName" value=""/>
  <Setting name="SqlAzurePassword" value=""/>
  <Setting name="SqlAzureDatabase" value=""/>
  <Setting name="UseDataStorage" value="true"/>
  <Setting name="UseDevelopmentStorage" value="false"/>
  <Setting name="UseCloudStorage" value="true"/>
  <Setting name="UseSqlAzure" value="false"/>
  <Setting name="LogLevel" value="Error"/>
  <Setting name="ScheduledTransferPeriodInSeconds" value="30"/>
  <Setting name="WindowsAzureStorageConnectionString" value="DefaultEndpointsProtocol=http;AccountName=myaccount;AccountKey=mykey"/>
  <Setting name="XDrives" value=""/>
  <Setting name="XDrivesLocalCache" value=""/>
</ConfigurationSettings>

以前有人做过吗?我的配置设置正确吗?

谢谢

【问题讨论】:

  • 至少,你错过了一个问题。
  • 我认为问题是“我怎样才能做到这一点?”
  • @McWafflestix 请查看添加的“?”
  • 您缺少的不仅仅是一个问号 MARK,而是一个实际的问题,例如“此配置是否缺少某些内容?”或者“如果其他人这样做了,他们是如何取得成功的?”远非迂腐,以这种方式表达事物将真正帮助您获得答案。
  • @McWafflestix 发生了变化,现在问题是根据您的要求制定的,我希望您能回答其中的一些问题。谢谢

标签: php azure cloud


【解决方案1】:

尝试以下方法:

require_once 'Microsoft/WindowsAzure/Storage/Queue.php'; 

$storageClient = new Microsoft_WindowsAzure_Storage_Queue();
if (azure_getconfig("UseDevelopmentStorage") != "true") {
  $storageClient = new Microsoft_WindowsAzure_Storage_Queue(
    'queue.core.windows.net',
    azure_getconfig("StorageAccountName"),
    azure_getconfig("StorageAccountKey")
  );
} 

if (!($storageClient->queueExists('worktodo'))) { 
  $result = $storageClient->createQueue('worktodo'); 
  echo 'Created queue: ' . $result->Name . "<br/>"; 
} else { 
  echo 'worktodo queue exists' . "<br/>"; 
} 


$storageClient->putMessage('worktodo', $id.','.$name, 3600); // 3600 = time-to-live of the message, if omitted defaults to 7 days 
echo($storageClient->getAccountName()); 

长话短说:在连接到 Windows Azure 存储时,您应该始终传递实际的连接详细信息。

【讨论】:

    【解决方案2】:

    你能检查一下 在项目中的ServiceConfiguration.cscfg 文件中?应该设置为“假”

    【讨论】:

    • 请查看我对配置设置的帖子的编辑,谢谢!
    猜你喜欢
    • 1970-01-01
    • 2022-12-17
    • 1970-01-01
    • 1970-01-01
    • 2017-09-30
    • 2013-04-24
    • 1970-01-01
    • 2018-05-06
    • 1970-01-01
    相关资源
    最近更新 更多