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.48k stars 10.03k forks source link

Best way for project with multiple client applications #46145

Open alkoval opened 1 year ago

alkoval commented 1 year ago

Hello, i have an Asp.Net Core 6 project with two Angular 14 apps. Sample project https://github.com/alkoval/AspNetCoreMultipleAngular

Client applications in the ClientApp and ClientApp2 folders. In Startup.cs added:

           app.Map(new PathString("/clientapp2"), client =>
            {
                var path = env.IsDevelopment() ? @"ClientApp2" : @"ClientApp2/dist";
                var clientAppDist = new StaticFileOptions()
                {
                    FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), path))
                };
                client.UseSpaStaticFiles(clientAppDist);

                if (env.IsDevelopment())
                {
                    client.UseSpa(spa =>
                    {
                        spa.Options.SourcePath = "ClientApp2";
                        spa.UseAngularCliServer(npmScript: "start");
                    });
                }
                else
                {
                    client.UseSpa(spa =>
                    {
                        spa.Options.StartupTimeout = new TimeSpan(0, 5, 0);
                        spa.Options.SourcePath = "ClientApp2";
                        spa.Options.DefaultPageStaticFileOptions = clientAppDist;
                    });
                }
            });

            app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });

The first client app is available at https://localhost:44313/. The second client app is available at https://localhost:44313/clientapp2 and in dev it reloads every time. I think this is because the DevServer has created a web socket at "url wss://localhost:44313/ng-cli-ws", when need to "url wss://localhost:44313/clientapp2/ng-cli-ws". Tell me please, how can i fix it? I would be grateful for any recommendations.

ghost commented 1 year ago

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Broderick890 commented 1 year ago

I really need this feature! Please help!

ghost commented 1 year ago

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.