Reputation: 171
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
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
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
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.:
Right click "Connected Services" and choose "Manage Connected Services":
Inside menu, disconnect "Storage Azurite emulator (Local)" if it is there. Otherwise, skip this step:
Click the "+" to add a dependency, select "Storage Azurite emulator (Local)", and click "Next":
Configure the following:
AzureWebJobsStorage
UseDevelopmentStorage=true
Do not save value anywhere
.Uncheck "C# code file(s)", "NuGet packages", and "Secrets store" from the summary of changes and click "Finish":
Upvotes: 7
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:
Select your Azure functions project to be "Single Startup Project"
F5 to debug (should now be successful in starting azurite)
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
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
Reputation: 201
Follow below steps
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
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