Azure应用服务VS WebJob [英] Azure App service VS WebJob

查看:96
本文介绍了Azure应用服务VS WebJob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对单独使用应用程序服务和通过Web作业使用应用程序服务之间的差异感到困惑.

I have a confusion over differences between using app service alone and app service with web jobs.

我有一个计算量大的任务(2-20分钟),必须手动触发(用户有时会要求它).现在,所有事情都发生在一个应用程序服务中.我正在考虑将此繁琐的过程提取到另一个应用程序服务中的webjob.这项新的应用程序服务将为空(不提供api服务),但将托管此Web作业,我将从第一个应用程序服务中触发该工作.

I have a computation intense task (2-20 min) that must be triggered manually (user asks for it from time to time). Right now everything happens in one app service. I'm thinking to extract this heavy process to a webjob in another app service. This new app service will be empty (no api served) but host this web job, which I'll trigger from first app service.

我很烦恼第二个应用程序服务将为空. 是否可以在不使用webjobs(仅WebApi项目)的情况下使用第二个应用程序服务来完成工作?还是我应该坚持使用webjobs?这两种方法的利弊是什么?

I'm bothered that second app service will be empty. Can I use second app service to do the work without using webjobs (just WebApi project)? Or I should stick to webjobs? What would be pros and cons of these two approaches?

推荐答案

在我看来,我们不应该比较网络api和网络作业.因为这两件事是用于不同的环境.

In my opinion, we shouldn't compare the web api and web jobs. Because this two things is used for different environment.

webjobs功能:

The webjobs feature:

    可以将
  • Web作业配置为手动触发或在Web上运行 时间表.

  • Web Jobs can be configured to be manually triggered or run on a schedule.

可以将Web作业配置为连续运行(也可以一直持续运行)

Web Jobs can be configured to be Continuously running (aka running constantly, all the time)

Azure Web Jobs可以满足任何后台处理需求.

Azure Web Jobs can be implemented to fill any background processing need.

因此,如果您要使用后台处理并且不想将响应返回给任何其他应用程序.我建议您可以选择网络工作.

So if you want to work with background processing and don't want to return the response to any other application. I suggest you could choose webjobs.

该Web api易于为客户构建HTTP服务以获取响应.

The web api is easy to build HTTP services for the customer to get the response.

因此,它用于与其他人进行交互.因此,如果您想获得结果并在其他任何地方使用.您可以选择网络API.

So this is used to interact with others. So If you want to get the result and used in any other place. You could choose web api.

网络api功能:

  • 属性路由
  • CORS-跨源资源共享
  • OWIN(.NET的开放式Web界面)自托管
  • Web API OData ...
  • Attribute Routing
  • CORS - Cross Origin Resource Sharing
  • OWIN (Open Web Interface for .NET) self hosting
  • Web API OData ...

总而言之,如果计算不会与其他人交互(将结果返回给客户),我建议您可以选择Web作业.

All in all, if the computation will not interact with others(return the result to customer), I suggest you could choose web jobs.

这篇关于Azure应用服务VS WebJob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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