I am getting below error while trying to debug an azure function, which is triggered every 30 secs and creates a file and uploads it on Azure storage account (using Azure Storage Emulator for development).

The listener for function 'Test' was unable to start. mscorlib: One or more errors occurred. Microsoft.Azure.WebJobs.Host: Please verify that the Azure Storage Emulator is running. Microsoft.WindowsAzure.Storage: The remote server returned an error: (500) Internal Server Error

Although the Azure Storage Emulator is up and running. Below is the my local.settings.jason -

enter image description here

Any pointers please?

2

There are 2 answers

12
Cindy Pau On

Since you use a locally virtualized Storage Emulator, then your Connecting String is correct.

If your firewall restricts func from accessing the Storage Account, then this error may be reported. The firewall is one of the reasons that the listener cannot access the virtual Storage Emulator.

When running the function locally, all triggers except httptrigger need to use the Storage Emulator. If the firewall restricts the listener's access to virtual storage, problems can occur when performing functions.

Try disabling the firewall and see if that resolves the issue.

Of course, it is also possible that the Storage Emulator service is not open. Try typing

"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" status

in cmd to check the status.

If it returns false, enter the following command to start the Storage Emulator:

"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" init
"%programfiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start

To sum up:

This type of problem is generally for three reasons.

1.Connection string error prevents connection,

2.firewall is set

3.some services are not turned on.

Have a look of the doc:

https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#start-and-initialize-the-storage-emulator

https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator#storage-emulator-command-line-tool-reference

0
Julio Pereira On

I would only comment an additional scenario; I was having the same issue on my local storage emulator, due to the fact that I had previously deleted the localdb (therefore deleting the emulator's db); then I created the emualtor's db by hand on ssms, which led to this error. If you are on a similar situation, make sure you have deleted any emulator related mdf or ldf files on user root folder, and then let the emulator create the db it requires (AzureStorageEmulatorDb510) by running AzureStorageEmulator.exe init.