Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure function gets 'Listener unable to start' error on linux

I am using Ubuntu Linux and I have been having issue when I try to run .Net core 2.2 Azure function app. A quick googling showed that it could be related to storage somehow but none of them were clear.

Although the runtime seems to start running normally, I get this error after a while:

[6/4/2020 8:35:09 am] The listener for function 'FunctionName' was unable to start.
[6/4/2020 8:35:09 am] The listener for function 'FunctionName' was unable to start. Microsoft.Azure.Storage.Common: Connection refused. System.Net.Http: Connection refused. System.Private.CoreLib: Connection refused.
like image 917
Stephanos B. Avatar asked Nov 04 '25 07:11

Stephanos B.


1 Answers

So I found the problem. I attempted to run my azure function on my windows partition and I was getting a similar error. It turned out the problem was the Azure Storage Emulator in both cases.

To fix it in windows I had to:

  • Delete all "AzureEmulatorDb" instances in /%USERPROFILE%
  • Then I had to run "SqlLocalDb i" to find all currently running local Dbs and delete them with "SqlLocalDb delete"
  • Lastly, I had to go into the SDK folder and run "./AzureStorageEmulator.exe init -forcecreate" to re-create the azureEmulatorDb and initialise a new configuration for the emulator

The fix in Linux was actually easier:

  • I downloaded Azurite, which is an open source Azure Storage emulator (https://github.com/azure/azurite)
  • Then I just run it with the "azurite" command before I started my azure function
like image 141
Stephanos B. Avatar answered Nov 05 '25 23:11

Stephanos B.