我们可以直接将Windows Azure移动服务与BLOB存储连接吗?

时间:2013-01-22 02:59:48

标签: javascript azure windows-8 azure-storage azure-mobile-services

我有一个关于如何使用Windows 8应用程序(Javascript)实现Windows Azure和Blob存储的问题。我们可以直接将Windows Azure移动服务与BLOB存储连接吗?

2 个答案:

答案 0 :(得分:4)

是的,您可以通过Windows Azure移动服务访问blob存储。基本上,您将通过服务器脚本使用blob存储。您将在Windows Azure SDK for Node.js中使用“azure”模块。

如果您将以下内容复制到脚本中,则会获得对Windows Azure blob的引用,之后您可以对其进行查询或向其中插入数据。

var azure = require('azure');
var blobService = azure.createBlobService("<< account name >>",
                                            "<< access key >>");

你可以在这里查看Scott Guthrie的帖子:http://weblogs.asp.net/scottgu/archive/2012/10/16/windows-azure-mobile-services-new-support-for-ios-apps-facebook-twitter-google-identity-emails-sms-blobs-service-bus-and-more.aspx

这篇文章详细介绍了如何使用Scheduler运行将数据备份到Blob存储的预定脚本:http://www.thejoyofcode.com/Using_the_scheduler_to_backup_your_Mobile_Service_database.aspx

这篇文章介绍了如何从移动服务上传图片到blob存储空间:http://www.nickharris.net/2012/11/how-to-upload-an-image-to-windows-azure-storage-using-mobile-services/

有关于使用blob的更多信息,请访问:http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/blob-storage/

希望有所帮助。

答案 1 :(得分:1)

我个人没有尝试过,但是对于Windows 8使用Windows Azure存储客户端库应该是可行的。您可以通过两种方式访问​​blob存储:

  1. 使用存储帐户名称和密钥:如果是客户端应用程序,则不推荐,因为您需要共享存储帐户名称和密钥,这是一个很大的安全性拥有密钥的任何人本质上都是该存储帐户的管理员。
  2. 使用共享访问签名(SAS):这是一种推荐的做法,因为您为blob存储提供了有限的时间限制权限。拥有SAS URL的用户只能执行允许他们执行的操作(例如,您可以限制用户删除blob容器中的blob,并且只允许他们在那里列出blob或上传文件。
  3. 请查看以下代码示例,其中使用Mobile Service生成SAS URL并将其传递到应用程序直接与Windows Azure Blob存储进行交互的Windows 8应用程序:http://code.msdn.microsoft.com/windowsapps/Upload-File-to-Windows-c9169190

相关问题