简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM