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.”
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.
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:
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:
You should now be good to go and can now debug your functions.