Very Funny
Very Funny
Explore posts from servers
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
cause @rendermode InteractiveServer might save me from the past 4 days of pain I have had
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
What are the Pro Cons of @rendermode InteractiveServer for server-side pages vs @rendermode InteractiveAuto for client-side pages?
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
not really, just glanced at the documentation and one youtube tutorial
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
I looked into AddKeyedSingleton etc. It feels like that would be what I'd need. Unsure how I would implement it though
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
c#
public AdminService(HttpClient httpClient)
{
_httpClient = httpClient;
_httpClient.BaseAddress = new Uri("https://localhost:7148/");
}
c#
public AdminService(HttpClient httpClient)
{
_httpClient = httpClient;
_httpClient.BaseAddress = new Uri("https://localhost:7148/");
}
I have a hacky fix that works, I might just keep it like this for now
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
No description
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
I think the double reference of IAdminService might be breaking it. Cause it also causes my ManageAdmin page to load twice
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
I spent the past few hours looking into it
38 replies
CC#
Created by Very Funny on 11/16/2023 in #help
HttpClient is not being registered
Scratch that, shit still broken
7 replies
CC#
Created by Very Funny on 11/16/2023 in #help
HttpClient is not being registered
But for some reason it decided it didn't want to persist to my AdminService
7 replies
CC#
Created by Very Funny on 11/16/2023 in #help
HttpClient is not being registered
No description
7 replies
CC#
Created by Very Funny on 11/16/2023 in #help
HttpClient is not being registered
i.e. builder.HostEnvironment.BaseAddress
7 replies
CC#
Created by Very Funny on 11/16/2023 in #help
HttpClient is not being registered
Sorted it, relied to heavily on impliclty defined variables. Even though I thought I had confirmed they were correcct
7 replies
CC#
Created by Very Funny on 11/16/2023 in #help
HttpClient is not being registered
The above debugging is from the AdminService on my clientside
7 replies
CC#
Created by Very Funny on 11/16/2023 in #help
Unable to find endpoints. Invalid URI
Fixed, needed .AddControllers and .MapControllers in my Program.cs
5 replies
CC#
Created by Very Funny on 11/16/2023 in #help
Unable to find endpoints. Invalid URI
This worked in .NET 7
5 replies
CC#
Created by Very Funny on 11/16/2023 in #help
Unable to find endpoints. Invalid URI
These are my endpoints
c#
[HttpGet("GetAllUsers")]
public async Task<ActionResult<List<UserInfo>>> GetAllUsers()
{
return Ok(await _adminService.GetAllUsers());
}

[HttpGet("GetUser/{id}")]
public async Task<ActionResult<UserInfo>> GetUser(string id)
{
return Ok(await _adminService.GetUser(id));
}
c#
[HttpGet("GetAllUsers")]
public async Task<ActionResult<List<UserInfo>>> GetAllUsers()
{
return Ok(await _adminService.GetAllUsers());
}

[HttpGet("GetUser/{id}")]
public async Task<ActionResult<UserInfo>> GetUser(string id)
{
return Ok(await _adminService.GetUser(id));
}
5 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
No description
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
It loads the data properly at first then it errors
38 replies
CC#
Created by Very Funny on 11/15/2023 in #help
Dependency Injection not working (.NET 8)
am having issues with my endpoints and URI
38 replies