Hi aspire team,
in my last try to use aspire I tried to add a blazor webassembly app to my project.
What I did so far is the following:
Add the blazor project to the aspire host with a reference to the backend:
using Aspire.Hosting;
var builder = DistributedApplication.CreateBuilder(args);
var server = builder.AddProject<Projects.ElsaServer>("elsaServer");
var webApp = builder.AddProject<Projects.ElsaStudio>("elsaStudio")
.WithReference(server);
var app = builder.Build();
await app.RunAsync();
Now I added the required packages to get service discovery to my blazor project
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.0.0-preview.3.24052.7" />
Then I added in my Program.cs of my blazor project the following lines:
builder.Services.AddServiceDiscovery();
builder.Services.ConfigureHttpClientDefaults(http =>
{
// Turn on resilience by default
http.AddStandardResilienceHandler();
// Turn on service discovery by default
http.UseServiceDiscovery();
});
Then I use as BaseAddress for my httpClient http://elsaServer/elsa/api
But when I run my blazor application I always get a HTTP Request from the browser on http://elsaServer/elsa/api and not on http://localhost:43432/elsa/api.
Something seems to not work here. And I don't know how to fix it.
So what I would wish to do is something like:
builder.Services.AddServiceDiscovery("http://aspireHost/serviceDiscovery");
So you can specify in you client apps where aspire lives and provide an API that the clients can use to discover the services
Hi aspire team,
in my last try to use aspire I tried to add a blazor webassembly app to my project.
What I did so far is the following:
Add the blazor project to the aspire host with a reference to the backend:
Now I added the required packages to get service discovery to my blazor project
Then I added in my
Program.csof my blazor project the following lines:Then I use as
BaseAddressfor myhttpClienthttp://elsaServer/elsa/apiBut when I run my blazor application I always get a HTTP Request from the browser on
http://elsaServer/elsa/apiand not onhttp://localhost:43432/elsa/api.Something seems to not work here. And I don't know how to fix it.
So what I would wish to do is something like:
So you can specify in you client apps where aspire lives and provide an API that the clients can use to discover the services