dotnet-architecture / eShopOnContainers

Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 7, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor. Moved to https://github.com/dotnet/eShop.
https://dot.net/architecture
24.58k stars 10.36k forks source link

Any reason I cannot to connect to service and container? #2169

Open wyxcoder opened 8 months ago

wyxcoder commented 8 months ago

When I use docker compose up, I can connect service like web status with localhost:5107. But when I start it in Visual Studio 2022. I cannot connect to any although the containers all up and good. Any idea?

Thanks

John0King commented 8 months ago

I have the reverse result , I can open the web page when I use visual studio with F5/Ctrl+F5 , but there alway be some service can not connect to rabbitMQ or Sqlserver when I use command docker compose build + docker compose up
and there is a service called "src-webshoppingagg-1" faild with flow exception.

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
   at System.Uri..ctor(String uriString)
   at Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Startup.ConfigureServices(IServiceCollection services) in /src/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs:line 39
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Program.Main(String[] args) in /src/src/ApiGateways/Web.Bff.Shopping/aggregator/Program.cs:line 18

I'm wonder what/where is the environment variables it used , and what visual studio do before docker start!