oskardudycz/EventSourcing.NetCore

ECommerce Sample APIs all using port 5000

BradKnowles opened this issue · 0 comments

Based on the settings of the launchUrl in the linked launchSettings.json profiles, it appears the intent is each API should be on it's own port. However, each one starts on port 5000.

PS C:\Code\EventSourcing.NetCore\Sample\ECommerce> dotnet run --project .\Carts\Carts.Api\Carts.Api.csproj
info: Microsoft.Hosting.Lifetime[0]
====>     Now listening on: http://localhost:5000  <====
info: Microsoft.Hosting.Lifetime[0]
====>     Now listening on: https://localhost:5001 <====
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Code\EventSourcing.NetCore\Sample\ECommerce\Carts\Carts.Api

PS C:\Code\EventSourcing.NetCore\Sample\ECommerce> dotnet run --project .\Orders\Orders.Api\Orders.Api.csproj
info: Core.Streaming.Consumers.ExternalEventConsumerBackgroundWorker[0]
      External Event Consumer started
info: Core.Streaming.Kafka.Consumers.KafkaConsumer[0]
      Kafka consumer started
info: Microsoft.Hosting.Lifetime[0]
====>      Now listening on: http://localhost:5000 <====
info: Microsoft.Hosting.Lifetime[0]
====>      Now listening on: https://localhost:5001 <====
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Code\EventSourcing.NetCore\Sample\ECommerce\Orders\Orders.Api

Adding applicationUrl to the launchSettings.json file should correct the issue. The added benefit being that the Swagger UI will automatically open on run from Visual Studio. Also, correcting this would allow multiple APIs to be running simultaneously.

"profiles": {
"CartsApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5500",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}

"profiles": {
"OrdersApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5501",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}

"profiles": {
"PaymentsApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5502",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}

"profiles": {
"ShipmentsApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5503",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}