skip to Main Content

Json – What's the best way to get result from ReadAsStringAsync response?

What I have This code calling my API: HttpResponseMessage response = await Http.GetAsync("https://localhost:7094/api/MyResource/94d0e5ca-2be7-42f7-94dc-13955c11595c"); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine($"RESPONSE: {responseBody}"); var payload = JsonSerializer.Deserialize<MyClass>(responseBody); var json = JsonSerializer.Serialize(payload); Console.WriteLine($"PAYLOAD: {json}"); This code is called from OnInitializedAsync in a NET8…

VIEW QUESTION

Redis – .net 8 aspire database issue

I experimenting with.net 8 aspire currently. I am following Microsoft documentation. I did a simple project with Backend api, frontend, and Redis cache. var builder = DistributedApplication.CreateBuilder(args); var cache = builder.AddRedisContainer("crediscache"); var weatherapi = builder.AddProject<Projects.WeatherApp_Api>("weatherapi"); builder.AddProject<Projects.WeatherApp_Web>("frontend") .WithReference(weatherapi) .WithReference(cache); All works…

VIEW QUESTION
Back To Top
Search