Azure Web 作业未触发并始终提供 "No job functions found"
Azure Web job not firing and always give "No job functions found"
我正在尝试 运行 带触发器的 Azure webjob,但我的 timerjob 方法没有触发。我收到以下消息。
未找到工作职能。尝试让你的工作 类 和方法 public。如果您正在使用绑定扩展(例如 ServiceBus、定时器等),请确保您已在启动代码中调用了扩展的注册方法(例如 config.UseServiceBus()、config.UseTimers (), 等等).
我正在使用 config.UseTimers() 但仍然显示消息。不确定下面的代码有什么问题
static void Main()
{
JobHostConfiguration config = new JobHostConfiguration();
config.UseTimers();
var host = new JobHost(config);
host.RunAndBlock();
}
public static void TimerTrig([TimerTrigger("0 */1 * * * *", RunOnStartup = true)] TimerInfo timer)
{
Console.WriteLine("Triggered");
}
我正在使用 Microsoft.Azure.WebJobs 和 Microsoft.Azure.WebJobs.Host v2.2.0;
根据您的描述,您的项目中似乎没有Function.cs文件。您可以在您的项目中添加一个 Functions.cs 文件并在其中添加您的 TimeTrig 函数。
我们还可以使用 VS 的 Webjob 模板创建 WebJob。您可以参考以下详细步骤。
1.Create 带有网络作业模板的网络作业。
2.Install Microsoft.Azure.WebJobs.Extensions
3.Add下面的代码在programm.cs
var config = new JobHostConfiguration();
config.UseTimers(); //add this code.
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
var host = new JobHost(config);
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
4.In Functions.cs 文件添加时间触发代码。
public static void TimerTrig([TimerTrigger("0 */1 * * * *", RunOnStartup = true)] TimerInfo timer)
{
Console.WriteLine("Triggered");
}
注意:请在[=55=中设置AzureWebJobsDashboard和AzureWebJobsStorage连接字符串] 对于此 WebJob 运行:
我正在尝试 运行 带触发器的 Azure webjob,但我的 timerjob 方法没有触发。我收到以下消息。
未找到工作职能。尝试让你的工作 类 和方法 public。如果您正在使用绑定扩展(例如 ServiceBus、定时器等),请确保您已在启动代码中调用了扩展的注册方法(例如 config.UseServiceBus()、config.UseTimers (), 等等).
我正在使用 config.UseTimers() 但仍然显示消息。不确定下面的代码有什么问题
static void Main()
{
JobHostConfiguration config = new JobHostConfiguration();
config.UseTimers();
var host = new JobHost(config);
host.RunAndBlock();
}
public static void TimerTrig([TimerTrigger("0 */1 * * * *", RunOnStartup = true)] TimerInfo timer)
{
Console.WriteLine("Triggered");
}
我正在使用 Microsoft.Azure.WebJobs 和 Microsoft.Azure.WebJobs.Host v2.2.0;
根据您的描述,您的项目中似乎没有Function.cs文件。您可以在您的项目中添加一个 Functions.cs 文件并在其中添加您的 TimeTrig 函数。
我们还可以使用 VS 的 Webjob 模板创建 WebJob。您可以参考以下详细步骤。
1.Create 带有网络作业模板的网络作业。
2.Install Microsoft.Azure.WebJobs.Extensions
3.Add下面的代码在programm.cs
var config = new JobHostConfiguration();
config.UseTimers(); //add this code.
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
var host = new JobHost(config);
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
4.In Functions.cs 文件添加时间触发代码。
public static void TimerTrig([TimerTrigger("0 */1 * * * *", RunOnStartup = true)] TimerInfo timer)
{
Console.WriteLine("Triggered");
}
注意:请在[=55=中设置AzureWebJobsDashboard和AzureWebJobsStorage连接字符串] 对于此 WebJob 运行: