相关疑难解决方法(0)

如何在Visual Studio中的其他端口上运行Azure Function应用程序

我在local.setting.json中设置本地主机端口.参考Microsoft doc https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local

该文件如下所示

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "AzureWebJobsDashboard": ""   
  },
  "Host": {
    "LocalHttpPort": 7073
  }
}
Run Code Online (Sandbox Code Playgroud)

当我运行/调试解决方案时,VS仍然在默认端口上托管应用程序(7071)

我已经检查了bin目录,该local.setting.json文件正在进行上述设置.从bin目录运行Azure Fucntion CLI(func host start)正确读取端口号.

看起来VS没有使用"LocalHttpPort"端口.设置中是否需要进行任何其他更改.我有Visual Studio 2017预览版(2)

azure azure-functions visual-studio-2017

45
推荐指数
9
解决办法
1万
查看次数

Azure Functions HTTP 集成测试

使用 VisualStudio 和 XUnit 在本地环境中测试 AzureFunctions [C#、HTTP 触发器] 的最佳方法是什么?

假设我有以下两个 Azure 函数:

  1. AF1:解析 JSON 输入并存储到数据库
  2. AF2:根据上传到数据库的数据生成 XML 文件

我想通过以下方式测试它们:

  1. 准备 JSON 并通过 HTTP 请求发送到第一个 Azure Function
  2. Azure 函数在 HTTP 响应中返回 documentId
  3. 通过 HTTP 请求将 documentId 发送到第二个 AzureFunction
  4. 测试输出 XML

是否可以从 XUnit 环境同时运行这两个 AzureFunction ?如何实现这一目标?我不想使用 Azure Function 本身测试 .dll,我想使用 HTTP 请求测试它。

c# xunit azure azure-functions visual-studio-2017

5
推荐指数
1
解决办法
2065
查看次数

标签 统计

azure ×2

azure-functions ×2

visual-studio-2017 ×2

c# ×1

xunit ×1