Nina
Nina

Reputation: 171

Azurite not starting automatically in Visual Studio 2022

I am unable to use a Blob Storage because in Visual Studio 2022 Azureite seems not to start automatically. Therefore I don't have access to databases etc.

Azure.Core: 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.

While starting VS I should see some information in the Output window that Azure Tools are being updated. I can't see any.

How can this be resolved?

Upvotes: 17

Views: 12616

Answers (7)

Brandon
Brandon

Reputation: 878

Deleting C:\Users\{username}\AppData\Local\.vstools\azurite worked for me. Although I did have to re-create all my queues.

Upvotes: 3

Gilles Tourreau
Gilles Tourreau

Reputation: 96

I fixed the issue just by updating the local.settings.json file of the Azure Function project.

The "AzureWebJobsStorage": "UseDevelopmentStorage=true" setting was missing for my Azure Function project.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    ... other settings ...
  }
}

And re-open the solution...

Upvotes: 0

digital_jedi
digital_jedi

Reputation: 636

I was unable to get Azurite to start automatically when running a Function project locally from VS2022, but fixed this issue by removing and re-adding the Azurite Service Dependency from the project.

After performing these steps, Azurite automatically starts now when I run the Function app locally in VS2022, with no need to manually start it via command line.:

  1. Right click "Connected Services" and choose "Manage Connected Services": Manage Connected Services

  2. Inside menu, disconnect "Storage Azurite emulator (Local)" if it is there. Otherwise, skip this step: Disconnect Storage Azurite emulator (Local)

  3. Click the "+" to add a dependency, select "Storage Azurite emulator (Local)", and click "Next":AddStorage Azurite emulator (Local)

  4. Configure the following:

  • Connection string name: AzureWebJobsStorage
  • Connection string value: UseDevelopmentStorage=true
  • Save connection string value in (radio button): Do not save value anywhere.
  • Note that the connection string name and value should correspond to the contents of your local.settings.json file. Click "Next".Configure Azuritelocal.settings.json
  1. Uncheck "C# code file(s)", "NuGet packages", and "Secrets store" from the summary of changes and click "Finish":Summary of changes

  2. When finished, you will see something like this: Finished configuration

Upvotes: 7

Paul Devenney
Paul Devenney

Reputation: 1329

First check which projects you are using in startup. Mine fails to start if using the "Configure Startup Projects | Multiple Startup Projects" options and the functions project I have (which knows to start azurite) has not already been executed.

In this scenario:

  1. Select your Azure functions project to be "Single Startup Project"

  2. F5 to debug (should now be successful in starting azurite)

  3. Switch back to multiple projects startup (should work, Azurite is already started)

This is essentially the same as "find your azurite location and start manually", but easier from within VS. It might work properly if the multiple projects startup order is changed to start with the Azure Functions project.

Upvotes: 8

James Love
James Love

Reputation: 1020

The only working solution I've come across for this to restart Windows (yes, really). Restarting VS 2022 doesn't have any effect.

Upvotes: 0

Sanuja Lavindika
Sanuja Lavindika

Reputation: 201

Follow below steps

  1. Close all the Visual Studio instances Opened (stop any Azurite processes)
  2. Need to find the temp files folder of Azurite
    Find the below path on your PC
    Ex: C:\Users<Username>\AppData\Local\Temp\Azurite

Move all files into another folder ex:'Old Azurite files' Note: Can remove if not needed

Now start Visual Studio and run the project

Referred this https://github.com/Azure/Azurite/issues/1309#issuecomment-1033390222

Upvotes: 3

anon
anon

Reputation:

Sometimes this would happen locally like Azurite Emulator stops suddenly. At that time, this type of issues occurs mostly.

To fix this, you have to start the Azure Storage Emulator manually.

It can be located in the path of C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator.

Open above path in the command prompt and run the Azurite emulator once as shown in the above link, which should clear the refusing connection issues.

Refer to this SO Thread and article for more workarounds for the same issue.

Upvotes: 3

Related Questions