Search code examples
azure-functionsazure-durable-functions

The listener for durable function was unable to start because the target machine actively refused it


I was successfully running Azure Durable Functions locally and now I am not able to run them and am getting the following error. Not sure what has changed -- any pointers on what to look at would be most appreciated.

For detailed output, run func with --verbose flag.
[2025-01-17T01:41:50.611Z] The listener for function 'Functions.CreateFunction' was unable to start.
[2025-01-17T01:41:50.614Z] The listener for function 'Functions.CreateFunction' was unable to start. DurableTask.AzureStorage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Http: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Sockets: No connection could be made because the target machine actively refused it.
[2025-01-17T01:42:25.739Z] The listener for function 'Functions.LoggerFunction' was unable to start.
[2025-01-17T01:42:25.901Z] The listener for function 'Functions.LoggerFunction' was unable to start. DurableTask.AzureStorage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Http: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Sockets: No connection could be made because the target machine actively refused it.
[2025-01-17T01:43:00.840Z] The listener for function 'Functions.OrchestratorFunction' was unable to start.
[2025-01-17T01:43:00.842Z] The listener for function 'Functions.OrchestratorFunction' was unable to start. DurableTask.AzureStorage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Http: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Sockets: No connection could be made because the target machine actively refused it.
[2025-01-17T01:43:34.455Z] The listener for function 'Functions.RetrieveNotificationsFunction' was unable to start.
[2025-01-17T01:43:34.457Z] The listener for function 'Functions.RetrieveNotificationsFunction' was unable to start. DurableTask.AzureStorage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Http: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Sockets: No connection could be made because the target machine actively refused it.
[2025-01-17T01:44:05.426Z] The listener for function 'Functions.SendNormalThresholdNotification' was unable to start.
[2025-01-17T01:44:05.428Z] The listener for function 'Functions.SendNormalThresholdNotification' was unable to start. DurableTask.AzureStorage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Http: No connection could be made because the target machine actively refused it. (127.0.0.1:10000). System.Net.Sockets: No connection could be made because the target machine actively refused it.

I tried adding this setting "AzureWebJobsSecretStorageType": "files" as suggested in https://github.com/Azure/azure-functions-host/issues/3795#issuecomment-430337085 but still running into the same issue. What am I missing?

local.settings.json

enter image description here


Solution

  • Start Azurite by running the below command in Command line, refer MSDOC:

    "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator\azurite.exe"
    

    Command response:

    C:\Users\uname>"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator\azurite.exe"
    Azurite Blob service is starting at http://127.0.0.1:10000
    Azurite Blob service is successfully listening at http://127.0.0.1:10000
    Azurite Queue service is starting at http://127.0.0.1:10001
    Azurite Queue service is successfully listening at http://127.0.0.1:10001
    Azurite Table service is starting at http://127.0.0.1:10002
    Azurite Table service is successfully listening at http://127.0.0.1:10002
    

    local.settings.json:

    {
        "IsEncrypted": false,
        "Values": {
            "AzureWebJobsStorage": "UseDevelopmentStorage=true",
            "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
        }
    }
    

    .csproj:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net9.0</TargetFramework>
        <AzureFunctionsVersion>v4</AzureFunctionsVersion>
        <OutputType>Exe</OutputType>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
      </PropertyGroup>
      <ItemGroup>
        <FrameworkReference Include="Microsoft.AspNetCore.App" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
      </ItemGroup>
      <ItemGroup>
        <None Update="host.json">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Update="local.settings.json">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
          <CopyToPublishDirectory>Never</CopyToPublishDirectory>
        </None>
      </ItemGroup>
      <ItemGroup>
        <Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
      </ItemGroup>
    </Project>
    

    Run the function:

    Functions:
    
            Function1_HttpStart: [GET,POST] http://localhost:7282/api/Function1_HttpStart
    
            Function1: orchestrationTrigger
    
            SayHello: activityTrigger
    
    For detailed output, run func with --verbose flag.
    [2025-01-17T06:02:09.380Z] Host lock lease acquired by instance ID '000000000000000000000000F72731CC'.
    [2025-01-17T06:02:10.555Z] Executing 'Functions.Function1_HttpStart' (Reason='This function was programmatically called via the host APIs.', Id=6cb9b9b8-ccf8-463f-a7a0-7dfc61e3e591)
    [2025-01-17T06:02:11.889Z] Scheduling new Function1 orchestration with instance ID '57314743ff4b42c9acd09c4d998a46fb' and 0 bytes of input data.
    [2025-01-17T06:02:12.375Z] Started orchestration with ID = '57314743ff4b42c9acd09c4d998a46fb'.
    [2025-01-17T06:02:12.595Z] Executed 'Functions.Function1_HttpStart' (Succeeded, Id=6cb9b9b8-ccf8-463f-a7a0-7dfc61e3e591, Duration=2108ms)
    [2025-01-17T06:02:12.634Z] Executing 'Functions.Function1' (Reason='(null)', Id=ead5d3dc-c0fb-4b1f-9706-6b499e4de813)
    [2025-01-17T06:02:13.053Z] Saying hello.
    [2025-01-17T06:02:13.150Z] Executed 'Functions.Function1' (Succeeded, Id=ead5d3dc-c0fb-4b1f-9706-6b499e4de813, Duration=569ms)
    [2025-01-17T06:02:13.303Z] Executing 'Functions.SayHello' (Reason='(null)', Id=0e088b50-c5de-4942-84a7-3945f28173b2)
    [2025-01-17T06:02:13.346Z] Saying hello to Tokyo.
    [2025-01-17T06:02:13.352Z] Executed 'Functions.SayHello' (Succeeded, Id=0e088b50-c5de-4942-84a7-3945f28173b2, Duration=55ms)
    [2025-01-17T06:02:13.639Z] Executing 'Functions.Function1' (Reason='(null)', Id=efe971d4-bbd9-4381-aeb8-b17d3911f871)
    [2025-01-17T06:02:13.678Z] Executed 'Functions.Function1' (Succeeded, Id=efe971d4-bbd9-4381-aeb8-b17d3911f871, Duration=46ms)
    [2025-01-17T06:02:13.763Z] Executing 'Functions.SayHello' (Reason='(null)', Id=4111dcd8-7df3-4f8e-bb12-cc809a987007)
    [2025-01-17T06:02:13.776Z] Saying hello to Seattle.
    [2025-01-17T06:02:13.780Z] Executed 'Functions.SayHello' (Succeeded, Id=4111dcd8-7df3-4f8e-bb12-cc809a987007, Duration=16ms)
    [2025-01-17T06:02:13.955Z] Executing 'Functions.Function1' (Reason='(null)', Id=2ed4521c-91f3-4da8-a9dc-5d531a6093eb)
    [2025-01-17T06:02:13.970Z] Executed 'Functions.Function1' (Succeeded, Id=2ed4521c-91f3-4da8-a9dc-5d531a6093eb, Duration=15ms)
    [2025-01-17T06:02:14.051Z] Executing 'Functions.SayHello' (Reason='(null)', Id=16693162-acde-416e-ac17-7623bef9b60e)
    [2025-01-17T06:02:14.067Z] Saying hello to London.
    [2025-01-17T06:02:14.070Z] Executed 'Functions.SayHello' (Succeeded, Id=16693162-acde-416e-ac17-7623bef9b60e, Duration=19ms)
    [2025-01-17T06:02:14.172Z] Executing 'Functions.Function1' (Reason='(null)', Id=66fcffd9-5f85-47d2-9382-80f36d1dce58)
    [2025-01-17T06:02:14.196Z] Executed 'Functions.Function1' (Succeeded, Id=66fcffd9-5f85-47d2-9382-80f36d1dce58, Duration=24ms)