microsoft / microsoft/aspire

Aspire doesn't replace http client Uri with actual address in blazor webassembly standalone app because it don't have appsettings.json

Open
#4,785 10 comments 5 reactions 1 assignee Claimed by @maraf View on GitHub
area-service-discovery blazor-wasm
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Describe the bug

i referenced the blazor project to Aspire app host so this is my aspire app host code

```
using AnswerMe.Aspire.AppHost;

var builder = DistributedApplication.CreateBuilder(args);

var identityServerDb=builder.AddPostgres("identityserver", password: builder.CreateStablePassword("AnswerMeDB-password"))
.WithDataVolume()
.WithPgAdmin()
.AddDatabase("IdentityServerDb");

var identityServerApi = builder.AddProject("identityserverapi")
.WithReference(identityServerDb);

var client = builder.AddProject("answermeclient")
.WithReference(identityServerApi);

builder. Build().Run();
```
and this is my blazor code to add HTTP client

builder.Services.AddHttpClient(nameof(HttpClients.IdentityServer),
client => { client.BaseAddress = new("http://identityserverapi"); });

so as you can see in the result it doesn't replace the `http://identityserverapi` with the actual address
file

and also i found the `builder.Configuration.GetConnectionString("identityserverapi");` doesn't work because we don't have `appsettings.json` in blazor wasm so i think Aspire doesn't work fo the blazor wasm

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.