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

Souvik Sardar 31 Reputation points
2022-01-18T02:30:54.43+00:00

I have one Azure function app and I am trying to run that locally but getting the below error. I have the storage emulator up and running. My 10000 port is busy to do something so I changed the port of emulator from AzureStorageEmulator.exe.config file and started with admin mood. it started successfully.

My storage emulator is running on 12000,12001, 12002 respectively for blob, queue, table.
165882-storage.png

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? I am not sure why the listener is trying to find 10000 if I run locally from Visual Studio 2022

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.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,838 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,772 questions
{count} vote

Accepted answer
  1. MayankBargali-MSFT 70,116 Reputation points
    2022-01-18T04:56:16.91+00:00

    @Souvik Sardar By default, the storage emulator services should be running on the below port as mentioned here. It looks like the below port might not be available and the storage services used a different port or the ports were changed manually.

    I will suggest you to navigate to the C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator directory (i.e the directory where your emulator is installed) and open the AzureStorageEmulator.exe.config file and update the ports to the default port as the function try to find the storage emulator services in the default IP and port.

     <services>  
          <service name="Blob" url="http://127.0.0.1:10000/"/>  
          <service name="Queue" url="http://127.0.0.1:10001/"/>  
          <service name="Table" url="http://127.0.0.1:10002/"/>  
     </services>  
    

    You can also use the below command to verify which service is using port 10001. Similarly, you can verify for other ports 10001 and 10002.

    netstat -p tcp -ano | findstr :10001  
    

    Update:

    In case someone is not able to kill the system process. The alternative would be specifying the below connection in your local.settings.json for every function that you will be running locally. You can modify the ports as per your need i.e. the ports where your storage service is running. The same is documented here on how you can use the other value instead of UseDevelopmentStorage=true

    "AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:20000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:20001/devstoreaccount1;TableEndpoint=http://127.0.0.1:20002/devstoreaccount1;",    
    
    6 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.