持久功能无法启动

时间:2018-02-12 08:19:34

标签: c# azure-functions

我在c#中开始使用azure持久功能时遇到了麻烦。将此作为样本并尝试从https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-sequence

在Visual Studio 2017中启动它
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}!";
        }
    }
 }

但我会收到此错误: &#34;功能的听众&#39; E1_SayHello&#39;无法开始。 Microsoft.WindowsAzure.Storage:无法连接到远程服务器。系统:无法连接到远程服务器。系统:无法建立连接,因为目标计算机主动拒绝它127.0.0.1:10000。&#34;

local.settings.json:

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

我是否需要完成其他工作或是否应该开箱即用?我需要在端口10000中拥有什么?

1 个答案:

答案 0 :(得分:2)

我的狡猾感觉在这里刺痛

你读过吗

Function chaining in Durable Functions - Hello sequence sample

<强>先决条件

  

按照Install Durable Functions中的说明进行设置   样本。

Install the Durable Functions extension and samples (Azure Functions)

<强>先决条件

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

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

您是否遵循了这些步骤?

Use the Azure storage emulator for development and testing