【发布时间】:2017-11-29 06:45:03
【问题描述】:
我正在尝试使用 Azure Functions 中的扩展,如 this question 所示,但无法使其正常工作。
我的代码是这样的:(预编译,消费计划)
public static class FirstFunction
{
[FunctionName("FirstFunction"),]
public static void Run([TimerTrigger("0 */5 * * * *", RunOnStartup = true)]TimerInfo myTimer, TraceWriter log)
{
log.Info($"Started = { TestExtension.Started }");
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
public class TestExtension : IExtensionConfigProvider
{
public static bool Started = false;
public void Initialize(ExtensionConfigContext context) {
Started = true;
Console.WriteLine("TestExtensionConsole");
context.Trace.Error("TestExtension");
throw new Exception("TextExtensionException");
}
}
但是在运行时什么都没有发生。我看到了来自计时器 Started = false 的日志,但没有别的。
我需要启用扩展或其他什么吗?
【问题讨论】:
标签: azure-functions precompiled