如何从azure网站访问作为azure blob托管的XML [英] How to access XML hosted as azure blob from azure website
问题描述
我目前正在寻找问题:
我们有一个后端应用程序创建XML文件的内容,并将它们存储为Azure Blob(我们不能更改此)。
I'm currently looking into problem: We have a backend application that creates XML files with content and stores them as Azure Blobs (we cannot change this).
Blob示例网址: http://mytestaccount.blob.core.windows.net
Blob sample url: http://mytestaccount.blob.core.windows.net
我们正在实现一个使用这些XML文件的网页。
We are implementing a webpage that consumes those XML files.
我们当前的解决方案是静态网页或任何其他服务器)托管在与提到的XML文件相同的blob。
Our current solution is static webpage (no iis or any other server required) hosted on the same blob as mentioned XML files.
问题1:有没有办法将域名重定向到我们目前托管为blob的网页?
Question 1: Is there a way to redirect a domain name to our webpage hosted currently as blob?
我们认为托管我们的Web应用程序不是Blob,而是使用Azure网站。这会产生跨网域请求的问题(我们必须获取这些XML文件)。
We thought about hosting our web application not as Blob but using Azure Web Sites. This creates a problem of cross-domain requests (we have to get those XML files).
网站示例网址: http://mytestpage.azurewebsites.net
问题2:有一种方法可以通过jquery ajax
Question 2: Is there a way to download XML by jquery ajax call from such a webpage (hosted as Azure Web Page) to xml stored as Blob?
推荐答案
从这样的网页(作为Azure网页托管)问题1:是否有一种方法可以将域名重定向到我们目前托管为blob的网页?
Question 1: Is there a way to redirect a domain name to our webpage hosted currently as blob?
是的,当然可以所以目前有一些限制。请参阅以下链接,了解如何配置指向blob存储的子域: http ://msdn.microsoft.com/en-us/library/windowsazure/ee795179.aspx 。请注意,目前您无法使用此方法为您的网站指定默认文档。
Yes, it's certainly possible to do so however there're some limitations currently. Please see this link regarding configuring a sub-domain which points to blob storage: http://msdn.microsoft.com/en-us/library/windowsazure/ee795179.aspx. Please note that currently you don't get an option to specify default document for your website with this approach.
问题2:通过jquery ajax调用从这样的网页(托管为Azure网页)到XML存储为Blob?
Question 2: Is there a way to download XML by jquery ajax call from such a webpage (hosted as Azure Web Page) to xml stored as Blob?
>读取blob不会导致跨域请求问题。当你试图在你的blob存储中发布/放置一些内容时,跨域问题就会出现。
只要你的blob容器是公开的,你应该能够访问blob没有任何问题。这是一个简单的GET。但是,如果你的blob容器是私有的,那么你需要在blob上创建一个具有读取权限的共享访问签名URI,并在jQuery AJAX调用中使用该URI。
更新:通过jQuery AJAX调用读取一个blob将给出跨域错误。
UPDATE: Reading a blob via jQuery AJAX call would give a "Cross Domain" error.
这篇关于如何从azure网站访问作为azure blob托管的XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!