【发布时间】:2019-03-30 03:55:46
【问题描述】:
我在 Visual Studio 中开发了一个 Azure 函数,它在 Azure 中发布时可以工作(从一年前开始)。
现在我在 Visual Studio 中使用该 Azure 函数制作了一个模板,并更改了一些细节,但基本相同。当我在本地测试它时,它工作正常。
但是当我在 Azure 中发布它并尝试对其进行测试时,我得到了这个错误:
The ConnectionString property has not been initialized
我通常在应用程序设置中编写连接字符串(它适用于较旧的 Azure 功能)。
以下是函数获取连接字符串值的方式:
var repo = new GranularRepository(ConfigurationManager.AppSettings["BoConnectionString"]);
我也试过了:
var repo = new AvgDeliveryTime_GranularRepository(Environment.GetEnvironmentVariable("BodbConnectionString"));
【问题讨论】:
-
在门户中浏览到应用程序时是否看到此设置的值?
-
查看此线程并在 6 月 25 日从 johnwc 发表评论。 github.com/Azure/Azure-Functions/issues/717
-
您在哪个版本的 Functions 运行时遇到此问题,v1 还是 v2?
标签: azure connection-string azure-functions