dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.4k stars 10k forks source link

ASP.NET 8 + ANGULAR Template with Docker breaks the SPA proxy #55614

Open Eugenenoble2005 opened 5 months ago

Eugenenoble2005 commented 5 months ago

Is there an existing issue for this?

Describe the bug

When an angular + asp.net 8 project is created with docker selected at the creation screen, all services are able to build and run however the spa proxy does not work because docker randomly reassigns the ports https port defined in the launchSettings.json. Is there a way around this?

Expected Behavior

SPA proxy should start and requests to the server applications should be forwarded to the client application (if they cannot be handled by the server).

Steps To Reproduce

Create a new project using the ASP.NET + Angular template. Enable docker support of the bat and select linux environment. Start the application, the weather forecast does not show in the angular app and there is an exception in the angular console making it clear the spa proxy has failed to start successfully because docker reassigns the ports

Exceptions (if any)

No response

.NET Version

8.0.204

Anything else?

No response

Andy-Leitzinger-FP commented 5 months ago

Has this issue been resolved or is there a workaround?

Eugenenoble2005 commented 5 months ago

Has this issue been resolved or is there a workaround?

Only workaround I've discovered so far is to just update the proxy URL in the proxy.conf.js whenever it changes.

Andy-Leitzinger-FP commented 5 months ago

Is it possible to force the generated debugging Docker image to have a fixed host port instead of the randomly generated one which keeps changing? Is there a Docker debugging deployment command/setting to fix the port number in Visual Studio 2022?