- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我实际上可以将 F# 控制台应用程序部署为 Azure WebJob 吗?在 VS2017 中找不到合适的选项:(
如果可以的话,你能看一下我的代码吗?如果我将其部署为 AzureWebJob,它会按原样工作吗?我需要改变什么吗?
open FSharp.Data;
open System
open System.Net.Mail
let server = "smtp.gmail.com"
let sender = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c0a6b3a8a1b2b0a9a5eeb3a5aea480a7ada1a9aceea3afad" rel="noreferrer noopener nofollow">[email protected]</a>"
let password = "password"
let port = 587
let SendTest email topic msg =
use msg =
new MailMessage(
sender, email, topic,
msg)
let client = new SmtpClient(server, port)
client.EnableSsl <- true
client.Timeout <- 20000
client.DeliveryMethod <- SmtpDeliveryMethod.Network
client.UseDefaultCredentials <- false
client.Credentials <- System.Net.NetworkCredential(sender, password)
client.Send msg
let metaTitle (doc:HtmlDocument) =
doc.Descendants "meta"
|> Seq.choose (fun x ->
match x.AttributeValue("name"), x.AttributeValue("property") with
| "title", _
| "headline", _
| "twitter:title", _
| _, "og:title" ->
Some(x.AttributeValue("content"))
| _, _ -> None
)
let titles (doc:HtmlDocument) =
let tagged (tag:string) =
doc.Descendants tag |> Seq.map (fun x -> x.InnerText())
Seq.concat [tagged "title"; metaTitle doc; tagged "h1"]
let title (doc:HtmlDocument) =
titles doc |> Seq.tryHead
let finalTitle (link:string) = try
link
|> HtmlDocument.Load
|> titles
|> Seq.head
with
| :? Exception as ex -> ex.Message
[<EntryPoint>]
let main argv =
let website = "website.com"
if(finalTitle website <> "expected title")
then
SendTest "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aad8cfd9dfc6deeacdc7cbc3c684c9c5c7" rel="noreferrer noopener nofollow">[email protected]</a>" "Status: Failed" (website + " is down :( ")
0 // return an integer exit code
最佳答案
Can I actually deploy F# console app as Azure WebJob?
是的,我们可以将 F# 控制台应用部署为 Azure WebJob
Can't find a proper option in VS2017
目前不支持直接从 VS2017 工具将 F# 项目发布为 Azure Webjob。
但是我们可以从Azure Portal发布F#项目。我为它做了一个演示。以下是我的详细步骤:
1.使用VS2017创建F#项目
2.在项目中安装WebJob SKD
3.构建项目并将release或debug文件压缩到bin文件夹中
4.从 Azure 门户上传 Zip 文件
5.使用存储连接字符串配置应用程序设置
6.使用Azure Kudu(https://yourwebsite.scm.azurewebsites.net)工具检查webjob
关于azure - 如何部署 F# Azure WebJob?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43402387/
我有一个 Azure WebJob,我正在从 visual studio 2017 发布到标准 S1 应用服务,WebJob 应该由 CRON 触发,但始终发布为连续,我无法弄清楚我做错了什么(另外两
我需要在计划的时间段内为不同的用户运行一项作业(例如 CRM 同步)。此同步由 ServiceBus 队列上的另一个函数放置的消息触发,该函数每 30 分钟由 TimerTrigger 触发一次。 现
我需要在计划的时间段内为不同的用户运行一项作业(例如 CRM 同步)。此同步由 ServiceBus 队列上的另一个函数放置的消息触发,该函数每 30 分钟由 TimerTrigger 触发一次。 现
我无法将计划的 Web 作业发布到 Azure 应用服务。我正在使用 Visual Studio 2017。 使用此设置一切正常: { "$schema": "http://schemastore.o
我计划使用连续的 Azure WebJob 发送电子邮件和推送通知。我了解 WebJobs 会因各种原因不时启动和停止。没关系,但我希望有机会在工作关闭之前“清理”一下。 这样我的 WebJob 可以
我已经看到了一些关于使用 settings.job 的指导。为此,但它不起作用 - 在控制台中我看到: WebJob singleton setting is False 如何防止横向扩展运行我的
我正在尝试部署一个触发的网络作业并使用 settings.json 文件安排它。我的 webapp 在 3 个实例中运行,所以我假设 webjob 将在 3 个实例中部署。因此,如果我使用带有 cro
我正在尝试找出是否有任何方法可以修改 webjobs sdk 重试策略。 现在,如果网络作业抛出异常,它会立即重新排队。这并不理想,特别是如果错误是由于数据库超时之类的原因造成的。 有谁知道该策略是否
我正在尝试部署一个触发的网络作业并使用 settings.json 文件安排它。我的 webapp 在 3 个实例中运行,所以我假设 webjob 将在 3 个实例中部署。因此,如果我使用带有 cro
我有一个启用了 Azure 持续交付的 Web 应用程序 (azure webapp)。这意味着每当我进行提交并将其推送到远程时,它都会自动构建应用程序并部署它。 我还有一些网络作业,我希望该过程也可
有没有办法从 MVC 应用程序中更改 webjob 的预定时间,或者是通过 azure 门户的唯一方法。 我不是指初始计划时间,而是在部署后通过 Mvc 应用程序中的 UI 更改计划时间。 最佳答案
Azure 提供了创建“触发式”WebJob 的可能性,例如每天都有时间表。 此外,还有 azure-webjobs-sdk-extensions( https://github.com/Azure/
我开始使用 WebJobs 来处理一些后台任务,但我遇到了关于错误处理和重试的问题。看来,如果我的任何函数是异步的,那么即使我在函数中抛出异常,该函数总是会在仪表板中报告成功。 考虑以下简单示例 ->
我们有一个带有“暂存”部署槽的 Azure 网站设置,我们使用连续的 Azure WebJob 来处理长时间运行的后台作业。看来,当您发布到网站(并包含 WebJob 二进制文件)时,如果 WebJo
我正在开发一个使用 TimerTrigger 的触发式网络作业. 在webjob停止之前,我需要处理一些对象,但我不知道如何触发“webjob停止”。 有了 NoAutomaticTrigger 函数
我正在处理一个网络作业,用于检查网络服务器的一些数据。有时网络服务器很忙,会在几秒钟后重试。 问题是,如果我只是忽略它并通过该函数,它将从队列中删除消息,我将无法重试调用。 我当前的解决方案(我一点也
我读过关于优雅关机的文章 here使用 WEBJOBS_SHUTDOWN_FILE 和 here使用取消 token ,所以我理解正常关闭的前提,但是我不确定它们将如何影响正在处理队列消息的 WebJ
如果运行webjob时出现任何异常或错误,我想释放所有对象。我如何知道是否发生错误。webjob 是否有任何错误触发器? 最佳答案 可以有两种方法来处理这个问题: 1) Try/Catch 方法:-
我在 AppService 中长时间运行 Web 作业(大约 1 小时)。AppService 已打开“始终打开”。 它的初始化是: var host = new JobHost(config); h
我在 AppService 中长时间运行 Web 作业(大约 1 小时)。AppService 已打开“始终打开”。 它的初始化是: var host = new JobHost(config); h
我是一名优秀的程序员,十分优秀!