My solutions are below. Please check below points.
Asked
Active
Viewed 498 times
-2
-
According to your description, we couldn't understand clearly about your question. Could you post more details information about the issue you have faced now? – Brando Zhang Sep 18 '17 at 01:45
1 Answers
2
public class Program
{
public static void Main()
{
JobHostConfiguration config = new JobHostConfiguration();
config.NameResolver = new TimeResolver();
config.UseTimers();
JobHost host = new JobHost(config);
host.RunAndBlock();
}
private class TimeResolver : INameResolver
{
public string Resolve(string name)
{
string value = string.Empty;
switch (name)
{
case "TimerJob":
Console.WriteLine("Name Is TimerJob : " + name);
value = "00:00:10";
break;
case "TimerJobAlter":
Console.WriteLine("Name Is TimerJobAlter : " + name);
value = "00:00:20";
break;
}
return value;
}
}
//Runs once every 30 seconds
public static void TimerJob([TimerTrigger("%TimerJob%")] TimerInfo timer)
{
Console.WriteLine("Timer1 job fired!");
}
// Runs once every 60 seconds
public static void TimerJobAlter([TimerTrigger("%TimerJobAlter%")] TimerInfo timer)
{
Console.WriteLine("Timer2 job fired!");
}
}

Mahesh Singh Bisht
- 23
- 3