时间触发 webjob,不会触发..直到我更改名称
Time trigger webjob, won't trigger.. until i change name
我在 sdk 3 中有一个网络作业。
public class NotificationsFunction
{
public async Task CustomerNotificationFunctionAsync([TimerTrigger("0 * * * * *")]TimerInfo myTimer, ILogger log)
log.LogInformation("Running job");
它曾经 运行 correctly.Now,如果我尝试在本地调试它,它就会挂起。它找到了功能但从未触发它:
现在,如果我只是更改名称:
public class NotificationsFunction
{
public async Task CustomerNotificationFunctionAsyncTest([TimerTrigger("0 * * * * *")]TimerInfo myTimer, ILogger log)
log.LogInformation("Running job");
它 运行 非常完美:
我在部署到 Azure 时遇到了完全相同的问题。
我不知道为什么会这样(我花了一段时间才发现这个问题)...
有人遇到过这个问题吗?如果是这样,我该怎么办?
谢谢
从这个document:
TimerTrigger uses the Singleton feature of the WebJobs SDK to ensure that only a single instance of your triggered function is running at any given time. When the JobHost starts up, for each of your TimerTrigger functions a blob lease (the Singleton Lock) is taken. This distributed lock ensures that only a single instance of your scheduled function is running at any time. If the blob for that function is not currently leased, the function will acquire the lease and start running on schedule immediately. If the blob lease cannot be acquired, it generally means that another instance of that function is running, so the function is not started in the current host.
锁 ID 基于完全限定的函数名称。
根据您在 sdk 3 中的 webjob,您可以使用 AddAzureStorageCoreServices。
var builder = new HostBuilder()
.ConfigureWebJobs(b=>
{
b.AddTimers();
b.AddAzureStorageCoreServices();
})
.Build();
I have the same exact problem when i deploy to azure.
另请注意,如果您在本地开发和生产部署之间共享同一个存储帐户,单例锁(blob 租约)将被共享。要解决此问题,您可以使用单独的存储帐户进行本地开发,也可以停止 Azure 中的作业 运行。
我在 sdk 3 中有一个网络作业。
public class NotificationsFunction
{
public async Task CustomerNotificationFunctionAsync([TimerTrigger("0 * * * * *")]TimerInfo myTimer, ILogger log)
log.LogInformation("Running job");
它曾经 运行 correctly.Now,如果我尝试在本地调试它,它就会挂起。它找到了功能但从未触发它:
现在,如果我只是更改名称:
public class NotificationsFunction
{
public async Task CustomerNotificationFunctionAsyncTest([TimerTrigger("0 * * * * *")]TimerInfo myTimer, ILogger log)
log.LogInformation("Running job");
它 运行 非常完美:
我在部署到 Azure 时遇到了完全相同的问题。 我不知道为什么会这样(我花了一段时间才发现这个问题)...
有人遇到过这个问题吗?如果是这样,我该怎么办? 谢谢
从这个document:
TimerTrigger uses the Singleton feature of the WebJobs SDK to ensure that only a single instance of your triggered function is running at any given time. When the JobHost starts up, for each of your TimerTrigger functions a blob lease (the Singleton Lock) is taken. This distributed lock ensures that only a single instance of your scheduled function is running at any time. If the blob for that function is not currently leased, the function will acquire the lease and start running on schedule immediately. If the blob lease cannot be acquired, it generally means that another instance of that function is running, so the function is not started in the current host.
锁 ID 基于完全限定的函数名称。
根据您在 sdk 3 中的 webjob,您可以使用 AddAzureStorageCoreServices。
var builder = new HostBuilder()
.ConfigureWebJobs(b=>
{
b.AddTimers();
b.AddAzureStorageCoreServices();
})
.Build();
I have the same exact problem when i deploy to azure.
另请注意,如果您在本地开发和生产部署之间共享同一个存储帐户,单例锁(blob 租约)将被共享。要解决此问题,您可以使用单独的存储帐户进行本地开发,也可以停止 Azure 中的作业 运行。