'Listener for Azure function was unable to start error while running Azure function app locally. How to solve this?

I have one Azure function app. I am trying to run that locally but getting the below error. I have the storage emulator up and running. Storage emulator status

Storage emulator status

I am not sure why it is complaining about 10000 port because my storage emulator is running on 12000,12001, 12002 respectively for blob, queue, table.

Local host file is like below,

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

Getting the below error at runtime. Can you pls guide me how the issue can be solved to run the function app locally?

The listener for function 'ABCFunction' was unable to start. Azure.Core: Retry failed after 6 tries. Retry settings can be adjusted in ClientOptions.Retry. (No connection could be made because the target machine actively refused it. (127.0.0.1:10000)) (No connection could be made because the target machine actively refused it. (127.0.0.1:10000)) (No connection could be made because the target machine actively refused it. (127.0.0.1:10000)) (No connection could be made because the target machine actively refused it. (127.0.0.1:10000)) (No connection could be made because the target machine actively refused it. (127.0.0.1:10000)) (No connection could be made because the target machine actively refused it. (127.0.0.1:10000)). Azure.Core: 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.



Solution 1:[1]

I am also facing the same issue.

enter image description here

I can fix this by using below steps:

Make sure you run your Storage Emulator with Admin privileges. Which was already mentioned by @ Thiago Custodio.

Killing the Function process & host process in the task manager

enter image description here

Now I can able to run the azure function without issue:

enter image description here

Solution 2:[2]

As you mentioned, your storage emulator is running on port 12000, 12001, 12002. You can try the following.

Check if endpoint is running

In CMD

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe status

Check storage emulator sql database is created and can start

AzureStorageEmulator.exe init

Check if have port conflict issue

AzureStorageEmulator.exe start

Change to other ports if needed

C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config

Then

AzureStorageEmulator.exe start

You can also explicitly specify the AzureWebJobsStorage to the url you specified

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:12000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:12001/devstoreaccount1;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DelliganeshS-MT
Solution 2 curtispy