c# - .net core azure WebJob 3.0.3 UseTimers 丢失
问题描述
我正在尝试使用 .net core 2.1 设置新的网络UseTimers()
作业,但在尝试配置作业时遇到了一个似乎丢失的问题。
在我的一生中,我似乎找不到任何可以为我指明正确方向的东西,因为文档似乎没有更新以反映使用HostBuilder
而不是JobHostConfiguration
.
我什至尝试过查看 WebJobs 扩展的源代码,但我似乎找不到任何帮助,我现在不知所措。
我有以下相当样板,但这仅在我不包含时才有效.UseTimers()
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions;
namespace marqueone.webjob
{
class Program
{
public static async Task Main(string[] args)
{
var builder = new HostBuilder()
.UseEnvironment("Development")
.ConfigureWebJobs(b =>
{
b.AddAzureStorageCoreServices()
.AddAzureStorage();
})
.ConfigureAppConfiguration(b =>
{
b.AddCommandLine(args);
})
.ConfigureLogging((context, b) =>
{
b.SetMinimumLevel(LogLevel.Debug);
b.AddConsole();
})
//.UseTimers()
.UseConsoleLifetime();
var host = builder.Build();
using (host)
{
await host.RunAsync();
}
}
}
}
解决方案
推荐阅读
- arrays - 使用 bash 在数组中旋转值
- javascript - fetch => response.json() 请求被拒绝
- r - 如何修复 R 中的“未定义列选择”错误?
- css - 更改输入自动完成框的颜色
- javascript - 如何通过 JavaScript document.querySelector 设置输入值
- swift - 如何搜索不认识的孩子
- c# - 使用 File.Exists 检查文件名是否存在 - 总是返回 false
- bash - “bash - apt-get”与此命令中的“apt-get”有何不同?
- django - 检索查询集的相关数据
- plsqldeveloper - 将新列添加到表时需要更改所有相关对象(简而言之)