1

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?

user13624867
  • 225
  • 4
  • 14

2 Answers2

3

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

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
  • Yes, I had checked with the mentioned command that the emulator is up and running, firewall is off and as I am using the local storage emulator so, as you said, connection string also looks correct. Still facing the issue. – user13624867 Nov 24 '20 at 07:21
  • When you say 'some services are not turned on', what services are you talking about here, can you please elaborate this? – user13624867 Nov 24 '20 at 07:22
  • @user13624867 What tools you are using to develop azure function? Is it Visual Studio? – Cindy Pau Nov 24 '20 at 07:41
  • @user13624867 Restart your computer, and then do below: If you are based on language like java or C#, go to the compiled folder and run 'func host start'. If you are based on script language like javascript or python. Just run 'func host start' under the project folder. See whether still have this problem. – Cindy Pau Nov 24 '20 at 07:45
  • @user13624867 In rare cases, this error was reported because the tool was damaged when installing the related tools of Storage Emulator using VS. Therefore, if you use Visual Studio for development, you may need to uninstall and reinstall Storage Emulator related tools – Cindy Pau Nov 24 '20 at 07:47
  • @user13624867 Please first restart your computer and test whether 'function core tools' have this problem.(This problem is sometimes limited to Visual Studio.) – Cindy Pau Nov 24 '20 at 07:50
  • Yes i am using VS. I have tried all the solutions from restarting computer, uninstalling/installing Storage Emulator, Function Core tools as well, however, nothing seems to be working. I am new to Azure Function App and now clueless about what to try now. – user13624867 Nov 24 '20 at 12:47
  • @user13624867 I don't know what happened on your side. . . In fact, your problem is often encountered by azure function novices. I don't know why the above solutions have no effect. . . Or you try to abandon using the local storage emulator and use the already created storage on Azure. (There may be a problem with your local storage) – Cindy Pau Nov 24 '20 at 13:24
  • @user13624867 Do you know how to get the connection string? – Cindy Pau Nov 24 '20 at 13:25
  • No I am not aware of how to get the connection string of storage created on Azure. Could you please give me some pointers or share some info on it? – user13624867 Nov 24 '20 at 13:48
  • @user13624867 Sorry for reply to late, have a look of this: https://i.stack.imgur.com/42cXq.jpg my computer borken so I am using iPad to edit,,, – Cindy Pau Nov 24 '20 at 14:08
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/225032/discussion-between-bowman-zhu-and-user13624867). – Cindy Pau Nov 24 '20 at 14:12
0

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.

Julio Pereira
  • 70
  • 1
  • 7