禁用Azure函数的属性在Visual Studio 2017中不起作用 [英] Disable Property of Azure Functions not working in Visual Studio 2017

查看:84
本文介绍了禁用Azure函数的属性在Visual Studio 2017中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有带计时器触发器的Azure功能.

I have Azure function with timer trigger.

public static void Run([TimerTrigger("0 */15 * * * *"), Disable("True")]TimerInfo myTimer, TraceWriter log)

此处Disable("true")不起作用.它生成function.json"disabled": "True",这是不正确的.它应该是"disabled": True, 禁用仅接受字符串值. 有什么办法可以改变这一点吗?或其他任何禁用功能的方法?

Here the Disable("true") is not working. it generates the function.json as "disabled": "True", which is not correct. It should be "disabled": True, Disable only accepts string value. Is there any way to change this? or any other way to disable function?

推荐答案

禁用属性的默认值为true.

使用Disable()代替Disable("true").

所以代码看起来像

public static void Run([TimerTrigger("0 */15 * * * *"), Disable()]TimerInfo myTimer, TraceWriter log).

如果要启用该功能,请使用Disable("False").

If you want to enable the function use Disable("False").

这篇关于禁用Azure函数的属性在Visual Studio 2017中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆