Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to connect to server side projct in blazor with .net9 from client project

$
0
0

I have created a Blazor Web Assembly project that has two projects: one server-side and one client-side. However, in .NET 8 and 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 on both client and server projectsbut in the server project, I can't get the address of 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?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>