如何从Azure的webjob天青webapp的沟通? [英] How to communicate from Azure webjob to Azure webapp?

查看:194
本文介绍了如何从Azure的webjob天青webapp的沟通?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行一个Azure的webjob旁边的Azure的Web应用程序。作业定期运行,并且需要在webapp作业的结果。我怎么得到的结果呢?

I'm running an Azure webjob alongside an Azure webapp. The job runs periodically and the result of the job is needed in the webapp. How do I get the result there?

我试图与WCF netNamedPipeBinding ,但因为不存在Azure的web应用没有启动任务,我不能添加一个net.pipe绑定到IIS网站,也没有我可以启用网.pipe协议。

I tried with a WCF netNamedPipeBinding but since there are no startup tasks for Azure webapps I cannot add a net.pipe binding to the IIS website nor can I enable the net.pipe protocol.

我现在用 basicHttpBinding的工作,但这种结合被暴露在我绝对不希望整个互联网。我只是想在同一台机器上webjob和运行Web应用程序之间的机器本地通信。

I have it working now with a basicHttpBinding but this binding is exposed to the entire internet which I absolutely do not want. I simply want machine-local communication between a webjob and webapp running on the same machine.

修正:我原本以为它的工作在Azure上,但事实并非如此。当在Azure上运行我从webjob得到一个错误:试图通过其访问权限不允许的方式来访问套接字127.0.0.1:80 (使用 basicHttpBinding的)。也许web应用程序有我不知道的内部端口号。

CORRECTION: I thought I had it working on Azure but that is not the case. When running on Azure I get an error from the webjob: An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:80 (using basicHttpBinding). Probably the webapp has an internal port number I don't know.

推荐答案

您有几种选择:


  1. 使用文件系统来传递消息

  2. 使用Azure存储队列两个
  3. 之间传递消息
  4. 使用Azure的服务总线队列以传递消息

  5. 使用任何共享存储(数据库,Azure存储等),以传递消息

  1. Use the file system to pass messages
  2. Use Azure Storage Queues to pass messages between the two
  3. Use Azure Service Bus Queue to pass messages
  4. Use any shared storage (database, Azure Storage, etc) to pass messages

所有这些方法的好处是,它使你的消息传递异步,从而更弹性的两个服务(Web应用程序或网站的工作)下降了一段时间之一。

The benefit of all these approaches is that it makes your message passing async and thus more resilient to one of the two services (web app or web job) going down for some time.

这篇关于如何从Azure的webjob天青webapp的沟通?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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