在Azure上运行的JavaScript网页计划任务 [英] Scheduled task on Azure that runs a webpage with javascript

查看:116
本文介绍了在Azure上运行的JavaScript网页计划任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有呈现了很多的JavaScript / CSS / XML和HTML的从第三方插件,并产生通过电子邮件发送给用户的PDF中的Azure网站数据驱动的视图。

I have a data-driven view on an Azure site that renders a lot of JavaScript/ CSS / XML and HTML from a third party plugin and generates a PDF which is emailed to a user.

我需要调用每周计划为每个用户这个页面 - 与Azure的乔布斯它真的直截了当地设置起来。但显然不会有JavaScript引擎来渲染code,它生成PDF,所以我有哪些选择?

I need to call this page on a weekly schedule for each user - and with Azure Jobs it's really straightforward to set this up. But obviously there will be no JavaScript engine to render the code that generates the PDF, so what are my options?

我会去对我的的Azure实例上安装的的NodeJS的路线?如果是的话需要哪些步骤和其他模块。

Would I have to go down the route of installing NodeJS on my Azure instance? If so what are the steps and other modules required.

该网站正在运行MVC C#和具有SQL后端。

The site is running MVC C# and has a SQL back end.

对于任何指针干杯。

推荐答案

如果你需要运行code可以分解/提取为Node.js的应用程序,你可以运行它作为计划的天青WebJob 。你可以找到关于如何在这里做细节。你并不需要安装Node.js的 - 它已经安装在所有Azure的应用服务工作者

If code you need to run can be factored / extracted as a Node.js app, you can run it as a scheduled Azure WebJob. You can find details on how to do that here. You don't need to install Node.js - it's already installed on all the Azure App Service workers.

有一点要注意的是,WebJobs运行的执行沙盒(详细信息的这里),并有对什么是允许在沙箱中运行一些限制。所以你不得不尝试着去看看你的PDF库运行成功那里。

One thing to note is that WebJobs run an execution sandbox (details here) and there are some restrictions on what is allowed to run in the sandbox. So you'd have to experiment to see if your PDF library runs successfully there.

例如,生成PDF流行的库之一的 wkhtmtopdf 不会在Azure应用服务工作。这 SO帖子更加详细地讨论这一点。一个用户已经成功托管在Azure中的VM wkhtmtopdf,并提供它作为一个服务,您可以拨打

For example, one of the popular libraries for PDF generation wkhtmtopdf will not work on Azure App Service. This SO post discusses this in more detail. One user has successfully hosted wkhtmtopdf on an Azure VM and offers it as a service that you can call.

这篇关于在Azure上运行的JavaScript网页计划任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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