无法使用已编译代码将文件推送到 Azure Functions

Unable to get files pushed with compiled code to Azure Functions

我有两个问题:

  1. 我需要从我正在复制的 json 文件中获取一些 json 数据 建设项目。然后我从 visual studio 发布了代码 2015 但是当代码在 Azure 上运行时,它无法访问文件 正在执行 dll 的文件夹。我怎样才能从中获取数据 那个文件。

  2. 当我将 Azure 函数从 visual studio 推送到 Azure 时, appsettings.json 值未发布到 Azure。

请避免一个问题问2个问题。

答案:

  1. 您可以从执行上下文中获取当前目录的路径,参见Retrieving information about the currently running function

  2. App.setting文件在FunctionApp的实际部署中没有用到,你应该在环境变量中定义你的设置,见How to manage a function app in the Azure portal.