在本地测试中使用云存储的WindowsAzure上的Php Eclipse
在dev fabric中运行角色时,我一直在尝试访问云上的队列。为此,我遵循以下步骤: 项目->属性->Windows Azure->数据存储,我选择了合适的字段并输入了我的凭据 然后,我做以下工作:在本地测试中使用云存储的WindowsAzure上的Php Eclipse,php,azure,cloud,Php,Azure,Cloud,在dev fabric中运行角色时,我一直在尝试访问云上的队列。为此,我遵循以下步骤: 项目->属性->Windows Azure->数据存储,我选择了合适的字段并输入了我的凭据 然后,我做以下工作: require_once 'Microsoft/WindowsAzure/Storage/Queue.php'; $storageClient = new Microsoft_WindowsAzure_Storage_Queue(); if( !($storageClient->queue
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());
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());
require_once'Microsoft/WindowsAzure/Storage/Queue.php';
$storageClient=新的Microsoft_WindowsAzure_存储_队列();
如果(!($storageClient->queueExists('worktodo')){
$result=$storageClient->createQueue('worktodo');
回显“已创建队列:”。$result->Name。“
”;
}否则{
回显“存在工作待办事项队列”。“
”;
}
$storageClient->putMessage('worktodo',$id','.$name,3600);//3600=消息的生存时间(如果省略),默认为7天
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>
你能检查一下这个值吗
是否在项目中的ServiceConfiguration.cscfg文件中?应将其设置为“false”尝试以下操作:
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());
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());
require_once'Microsoft/WindowsAzure/Storage/Queue.php';
$storageClient=新的Microsoft_WindowsAzure_存储_队列();
if(azure_getconfig(“UseDevelopmentStorage”)!=“true”){
$storageClient=新的Microsoft\u WindowsAzure\u存储\u队列(
'queue.core.windows.net',
azure_getconfig(“StorageAccountName”),
azure_getconfig(“StorageAccountKey”)
);
}
如果(!($storageClient->queueExists('worktodo')){
$result=$storageClient->createQueue('worktodo');
回显“已创建队列:”。$result->Name。“
”;
}否则{
回显“存在工作待办事项队列”。“
”;
}
$storageClient->putMessage('worktodo',$id','.$name,3600);//3600=消息的生存时间(如果省略),默认为7天
echo($storageClient->getAccountName());
长话短说:在连接到Windows Azure存储时,您应该始终传递实际的连接详细信息。至少,您遗漏了一个问题。我认为问题是“我如何才能做到这一点?”@McWafflestix请查看添加的“?”您遗漏的不仅仅是一个问号,而是一个实际的问题,例如“此配置是否缺少某些内容?”或“如果有其他人这样做,他们是如何取得成功的?”?“用这种方式表达问题绝非迂腐,反而会真正帮助你得到答案。@McWafflestix改变了,既然问题是按照你的要求制定的,我希望你能回答其中一些问题。”。谢谢,请查看我的帖子中的配置设置编辑,谢谢!