c# - 如何向解决方案添加第二个 azure 功能?

标签 c# .net azure visual-studio-2017 azure-functions

我经历了以下过程,将第二个 Azure 函数添加到我的解决方案中:

enter image description here

当尝试在本地运行时,出现以下异常:

enter image description here

HTTP could not register URL http://localhost:7071/ because TCP port 7071 is being used by another application. Press any to continue....[10/30/2018 8:52:01 PM] Loaded custom extension 'BotFrameworkConfiguration' [10/30/2018 8:52:01 PM] Loaded custom extension 'SendGridConfiguration' [10/30/2018 8:52:01 PM] Loaded custom extension 'EventGridExtensionConfig' [10/30/2018 8:52:01 PM] registered EventGrid Endpoint = http://localhost:7071/admin/extensions/EventGridExtensionConfig [10/30/2018 8:52:02 PM] Generating 0 job function(s) [10/30/2018 8:52:02 PM] Found the following functions: [10/30/2018 8:52:02 PM] TranslatorFunctions.Function1.Run [10/30/2018 8:52:02 PM] .Apps.Alidade.TranslatorFunctions.OnTranslateHTTPTriggered.Run [10/30/2018 8:52:02 PM] TranslatorFunctions.OnTranslateParameterizedHTTPTriggered.Run [10/30/2018 8:52:02 PM] [10/30/2018 8:52:02 PM] Host initialized (1467ms) [10/30/2018 8:52:02 PM] Host started (1505ms) [10/30/2018 8:52:02 PM] Job host started [10/30/2018 8:52:02 PM] The following 3 functions are in error: [10/30/2018 8:52:02 PM] Function1: Cannot access a disposed object. [10/30/2018 8:52:02 PM] OnTranslateHTTPTriggered: Cannot access a disposed object. [10/30/2018 8:52:02 PM] OnTranslateParameterizedHTTPTriggered: Cannot access a disposed object. [10/30/2018 8:52:02 PM] [10/30/2018 8:52:02 PM]

我做错了什么?我们如何允许多个 azure 函数在同一个解决方案上运行?

最佳答案

我解决此问题的方法是转到文件 local.settings.json 并将 Host 部分添加到该文件中:

{
  "IsEncrypted": false,
  "Values": {},
  "Host": {
    "LocalHttpPort": 7073
  }
}

关于c# - 如何向解决方案添加第二个 azure 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53072796/

相关文章:

c# - 无法调试 dotnet 核心 GenericHost docker 容器

c# - 在表达式树中引用 "this"

powershell - 如何将非默认目录中的客户端授权给 KeyVault

c# - 如何在 C# 中比较 XmlDocument 的两个 XmlNode?

C#引发事件

c# - 序列化继承 : Will an exception be thrown if the base class isn't marked [Serializable]?

c# - 为隐式调度方法显式指定 TaskScheduler

c# - 如何开发DirectX应用程序?

azure - 如何通过 Http 公开 DocumentDB 附件?

azure - 找不到 blob 文件时出现 FunctionInitationException