Thursday, 27 December 2018

Azure Function - The listener for function was unable to start

Issue

When debugging one of my Azure Functions in Visual Studio 2017, I got the error below:

“The listener for function 'MyFunction' was unable to start. Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. System.Net.Http: No connection could be made because the target machine actively refused it. System.Private.CoreLib: No connection could be made because the target machine actively refused it.”

image

After a Google search, I didn’t find much on the error message. I figured I’d write up the solution for the next person who has this problem.

Solution

I figured that this may be a firewall issue or a problem with one of the services that wasn’t started so I tried to eliminate those causes. I found that all services were started and that even with the firewall disabled, I still had the issue. I resorted to the classic turn it off and on again and that still didn’t fix it.

Eventually, it occurred to me to check that the Azure Storage Emulator was started and I found that it wasn’t. To check if it’s started, run the command below:

image

If you see IsRunning as False like above then you’re going to need to initialize and start the Azure Storage Emulator by running the commands below:

We can then check that the Azure Storage Emulator is running again by checking the status and we can see IsRunning is now True:

image

You should now be good to go and can now debug your functions.

7 comments:

  1. Thanks for posting. Its an Important topic to be read.
    MS Azure Online Training

    ReplyDelete
  2. Wow! this is Amazing! Do you know your hidden name meaning ? Click here to find your hidden name meaning

    ReplyDelete
  3. Is it possible to debug locally (ie. in VS Code) but without the Storage Emulator (Meaning you hit Azure Storage on the Cloud directly)? When I attempt to debug a function (Using PowerShell) the first popup i get says it cannot find a local emulator. Is there a config setting I missed?

    ReplyDelete