❔ "Cannot assign requested address [::1]:27017" when connecting to MongoDB on Docker.
I have a Docker Compose file with containers
-
backend
: ASP.NET Core web API
- mongo
: MongoDB
which looks like this:
With the API, I followed two tutorials:
- https://learn.microsoft.com/en-us/aspnet/core/web-api/?WT.mc_id=dotnet-35129-website&view=aspnetcore-7.0
- https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mongo-app?view=aspnetcore-7.0&tabs=visual-studio-code
I then containerized it and started mongod
in a ./Data
directory.
When connecting to the database (on the mongo container) with this appsettings.json
I recieve an error from the backend container. (attached)
New to MongoDB, Docker, and ASP.NET. Let me know if you want any additional information.Create web APIs with ASP.NET Core
Learn the basics of creating a web API in ASP.NET Core.
Create a web API with ASP.NET Core and MongoDB
This tutorial demonstrates how to create an ASP.NET Core web API using a MongoDB NoSQL database.
2 Replies
i shouldnt ping roles should i
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.