我正在尝试在 Azure 中设置计划的 WebJob。我能够部署我的网络作业。我可以通过门户明确运行网络作业。但是,我似乎无法让它按定期计划运行。
我希望该作业每 5 分钟运行一次。我意识到这不是免费的,我已更改为付费套餐并调整了最大重复阈值设置。有一次我因为设置而收到错误。
当我部署时,WebJob 显示为“按需”,并且它不会重复运行。我究竟做错了什么?
这是我所拥有的:
webjob-发布-settings.json
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "Shopping-Logs-WebJob",
"startTime": "2016-01-07T00:00:00-08:00",
"endTime": null,
"jobRecurrenceFrequency": "Minute",
"interval": 5,
"runMode": "Scheduled"
}
Run Code Online (Sandbox Code Playgroud)
程序.cs
public class Program
{
static void Main()
{
var host = new JobHost();
host.Call(typeof(Functions).GetMethod("ManualTrigger"));
}
}
Run Code Online (Sandbox Code Playgroud)
函数.cs
public class Functions
{
[NoAutomaticTrigger]
public static void ManualTrigger(TextWriter log)
{
string storageAccountName = CloudConfigurationManager.GetSetting("AzureStorageAccountName");
string storageKey = CloudConfigurationManager.GetSetting("AzureStorageAccessKey");
SendMessage("String Fetched", (storageAccountName ?? String.Empty) + ":" + (storageKey ?? String.Empty));
if (String.IsNullOrWhiteSpace(storageAccountName) || String.IsNullOrWhiteSpace(storageKey))
{ …Run Code Online (Sandbox Code Playgroud)