我正在尝试使用我的 Azure Functions 应用程序设置添加一些自定义绑定(bind)。我只需要从我的设置中接收字符串。
我想从我的设置中获取 simpleValue。
{
"bindings": [
{
"name": "someValue",
"type": "stringSetting",
"connection": "simpleValue",
"direction": "in"
}
],
"disabled": false
}
并在 Run 方法中获取它:
static void GetOrders(TraceWriter log, string someValue)
{
log.Info(someValue);
}
有可能吗?也许还有其他方法可以做到这一点?
最佳答案
我已经找到解决方案了。只需添加:
using System.Configuration;
并将此行添加到带有键(“simpleValue”)值的代码中:
ConfigurationManager.AppSettings["simpleValue"]
关于c# - Azure Functions 如何将应用程序设置添加到绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40260556/