c# - 持久功能无法启动

标签 c# azure-functions

我在开始使用 C# 中的 azure 持久函数时遇到问题。以此为示例并尝试在 Visual Studio 2017 中从 https://learn.microsoft.com/en-us/azure/azure-functions/durable-functions-sequence 启动它

using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;

namespace VSSample
{
    public static class HelloSequence
    {
        [FunctionName("E1_HelloSequence")]
        public static async Task<List<string>> Run(
            [OrchestrationTrigger] DurableOrchestrationContext context)
        {
            var outputs = new List<string>();

            outputs.Add(await context.CallActivityAsync<string>("E1_SayHello", "Tokyo"));
            outputs.Add(await context.CallActivityAsync<string>("E1_SayHello", "Seattle"));
            outputs.Add(await context.CallActivityAsync<string>("E1_SayHello", "London"));

            // returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
            return outputs;
        }

        [FunctionName("E1_SayHello")]
        public static string SayHello([ActivityTrigger] string name)
        {
            return $"Hello {name}!";
        }
    }
 }

但是我会收到这个错误: “函数“E1_SayHello”的监听器无法启动。Microsoft.WindowsAzure.Storage:无法连接到远程服务器。系统:无法连接到远程服务器。系统:无法建立连接,因为目标计算机主动拒绝它 127.0.0.1:10000。”

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true"
  }
}

我需要做其他事情吗?还是应该开箱即用?端口 10000 需要什么?

最佳答案

我的蜘蛛侠感觉在这里刺痛

你读过吗

Function chaining in Durable Functions - Hello sequence sample

先决条件

Follow the instructions in Install Durable Functions to set up the sample.

Install the Durable Functions extension and samples (Azure Functions)

先决条件

  • 安装最新版本的 Visual Studio(版本 15.3 或更高版本)。将 Azure 开发工作负载包含在设置选项中。 从示例函数开始
  • 下载 Visual Studio 的示例应用程序 .zip 文件。您无需添加 NuGet 引用,因为示例项目已包含它。
  • 安装并运行 Azure 存储模拟器版本 5.2 或更高版本。或者,您可以使用真实的 Azure 存储连接字符串更新 local.appsettings.json 文件
  • 在 Visual Studio 2017 中打开项目。有关如何运行示例的说明,请从函数链 - Hello 序列示例开始。 示例可以在本地运行或发布到 Azure

该错误很可能是尝试连接到模拟器但未安装或设置。

那么您遵循这些步骤了吗?

Use the Azure storage emulator for development and testing

关于c# - 持久功能无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48742056/

相关文章:

javascript - C# json解析格式

c# - 如何在 C# 中使用定时器和事件?

c# - 如何在 nopcommerce 中添加命名空间?

java - java中的Azure应用程序功能用于查看azure存储帐户中的blob文件列表

azure - 启动 Cosmos DB 模拟器时出错

Azure Function 多个作业主机

c# - 从另一个 ClickOnce 应用程序启动 ClickOnce 应用程序

c# - ExcelDNA/托管 XLL/Excel 互操作

azure - 在 Visual Studio 中调试 Azure Function 时创建的日志文件在哪里

c# - Azure 存储事件触发器 - 捕获正在删除的 blob