从客户端访问的Windows Azure队列的JavaScript / jQuery的 [英] Accessing Windows Azure Queues from client side javascript/jquery

查看:88
本文介绍了从客户端访问的Windows Azure队列的JavaScript / jQuery的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于UI的功能,我需要从Windows Azure的队列中读取并相应地更新UI。

For a UI feature, I need to read from a Windows Azure queue and update the UI accordingly.

我看到很多的例子的Node.js,但没有使用纯Javascript或Jquery的。 ( azureQuery 接近,但还没有排队的功能,它需要一个Web API交谈)

I see plenty of node.js examples, but nothing using pure Javascript or Jquery. (azureQuery comes close, but no queue functionality yet and it needs a Web API to talk to)

这是同时使用asp.net和MVC 4生成这个特定页面使用MVC 4的混合Web应用程序。

This is a hybrid web app using both asp.net and MVC 4. This particular page is generated using MVC 4.

任何建议将是AP preciated。

Any suggestions would be appreciated.

罗伯托
(PS。能够写入队列也将是不错)

Roberto (PS. being able to write to the queue would also be nice)

推荐答案

这直接是不可能从浏览器。 JavaScript的浏览器必须遵循同源策略,这意味着JavaScript可以只作出了当前网页的域调用。由于您的网页将不会从&LT送达;账户> .queue.windows.net ,这意味着你的JavaScript将无法调用该域的API。 (这将是在大多数浏览器可能的,如果队列服务担任了 CORS 头,但它没有。)

This isn't possible directly from the browser. JavaScript in the browser has to follow the same-origin policy, which means that JavaScript can only make calls to the domain of the current web page. Since your web page won't be served from <account>.queue.windows.net, it means your JavaScript won't be able to call APIs on that domain. (This would be possible in most browsers if the queue service served up CORS headers, but it doesn't.)

您将需要举办一个网络终端(在你的MVC应用4,可能)的代理队列中的消息。你的JavaScript将消息发送到您的Web应用程序,你的web应用程序会把消息队列。

You'll need to host a web endpoint (in your MVC 4 app, probably) that proxies queue messages. Your JavaScript will send a message to your web app, and your web app will put the message on the queue.

这篇关于从客户端访问的Windows Azure队列的JavaScript / jQuery的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆