如何检查文件是否存储在 Azure Blob 中
我们的网站(Azure 网站)上运行着一个 Flash 应用程序。它需要访问 blob 存储中的图像。我必须以编程方式创建一个 crossdomain.xml 文件,这样 Flash 获得跨域限制就不会出现任何问题。
但由于某种原因,我无法检查该文件是否存在,因此每次页面加载时都会重新创建该文件。我查找的每个示例都涉及检查 blob 存储容器是否存在,我只想找到此文件。
We have a flash app running on our web site (which is a Azure site). It needs to access images in blob storage. I had to create a crossdomain.xml file programatically so there won't be any issues with Flash getting cross domain restrictions.
But for some reason, I cannot check to see if that file exists, so every time the page loads it re-creates the file. Every example I look for talks about checking to see if the blob storage container exists, I just want to find this file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的 Blob 容器是公共的并且您知道 Blob 的名称,则可以手动发送 Blob 的 HTTP 请求(例如 http://myaccount.blob.core.windows.net/mycontainer/myblob)并检查结果。如果结果是 404(未找到)错误,则意味着该 blob 不存在。但是,如果 Blob 容器是私有的,那么您可以尝试使用 REST API 或存储客户端库来获取 Blob 的属性。 404 错误意味着该 blob 不存在。但是,您需要考虑您的存储帐户凭据,因为您提到它是 Flash 应用程序,并且您可能不希望将凭据存储在应用程序本身中。
If your blob container is public and you know the name of the blob, you can manually send a HTTP request for the blob (e.g. http://myaccount.blob.core.windows.net/mycontainer/myblob) and check the result. If the result is 404 (Not Found) error, that means the blob does not exist. However if the blob container is private, then what you could do is try and fetch the properties of the blob either by using REST API or Storage Client library. A 404 error would mean that the blob does not exist. However you would need to think about your storage account credentials as you mentioned it is a Flash application and you may not want to store the credentials in the application itself.
像 Cerebrata 的 Cloud Storage Studio 这样的工具会有帮助吗?您可以浏览 Azure 存储内容以查看该 blob 是否存在,还可以查看您的应用程序是否不断创建新的 blob。
开发者版是免费的。
Is a tool like Cerebrata's Cloud Storage Studio something that would help? You can browse your Azure storage contents to see if that blob exists, and also see if your application is continuously creating new ones.
The Developer Edition is free.