I have created a Blazor web assembly project that has two projects: a server-side and a client-side project. However, in .NET 8 and .NET 9, it is not possible to access the resources of the server-side project through client components.
I tried to define HttpClient in Program.cs in both the client and server projects, but in the server project, I can't get the address of the site:
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });The server project can not find the HostEnvironment.BaseAddress.
How I can resolve this problem?