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.

11 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
  4. Need a Debt Loan To Pay Off Bills?
    Take control of your debt today
    Available Now Business Expansion Loan Offer?
    Do you need a loan to pay off Bills?
    Do you need a loan?
    Do you need Personal Loan?
    Business Expansion Loan?
    Business Start-up, Education,
    Debt Consolidation Loan
    Hard Money Loans
    Loan for any thing ?
    We offer loan at low interest rate of 3%
    Loan with no credit check,
    Email us: financialserviceoffer876@gmail.com
    Call or add us on what's app +918929509036

    ReplyDelete
  5. Thank you for the explanation.

    I found an alternate way to fix the issue when we are running a time trigeer.
    https://stackoverflow.com/questions/48335887/the-listener-for-function-was-unable-to-start-why/68581191#68581191

    ReplyDelete