85,410 questions
3
votes
2
answers
57
views
Required attribute is not working for the body request at the method of API endpoint
I have simple API methods. I need to check whether the body request is null. For example:
[HttpPost]
public ActionResult<Product> CreateProduct([FromBody] Product product)
{
if (product == ...
0
votes
0
answers
29
views
How to create integration tests with Keycloak and xUnit?
I'm creating a new project with Keycloak and .NET Core 9. I've managed to get it working with my application, but I need to make it work with my integration tests.
To integrate authorization and ...
1
vote
0
answers
27
views
How to delay initialization of SQL-based configuration in ASP.NET Core startup without using BuildServiceProvider?
I am using an ASP.NET Core 9.0 Web API with C#. My application setup uses L1 Cache using FusionAPI and L2 is Garnet Server for distributed layer of cache. The following code snippet is from my Startup....
0
votes
0
answers
46
views
Forcing single implementation registration
I am looking for a design pattern in .NET Core but couldn't find any.
I have an extension method that registers interfaces:
private static void RegisterImpls(this IServiceCollection services)
{
...
0
votes
1
answer
107
views
How can I refactor a widely-used C# class to support constructor dependency injection without breaking existing usages? [closed]
In my C# ASP.NET Core project, I have a class that is currently instantiated using a parameterless constructor. This class is used in hundreds of places throughout the solution.
I now need to refactor ...
-2
votes
0
answers
29
views
The application installed on the server restarts by itself at irregular intervals [closed]
My application hosted on IIS restarts itself at irregular intervals. When I check the Windows Event Logs, I only see entries indicating that the application was stopped and started—nothing more. The ...
-1
votes
0
answers
42
views
Failed Endpoint fetching [closed]
I have correctly crosschecked the endpoint names, my code is running just fine but I kept a breakpoint on the get method in the user controller the code doesn't seem to enter. the html and css is just ...
0
votes
0
answers
55
views
Setting up ContentType for model binding errors in ASP.NET Core
When model binding error (example: /clients/abc instead of /clients/123) on [ApiController] occurs we get an automatic 400 Bad Request with content-type: application/json; charset=utf-8.
Is there a ...
0
votes
0
answers
51
views
How to integrate ASP.NET Core Identity with Clean Architecture while maintaining domain independence? [closed]
I'm building an ASP.NET Core application following Clean Architecture and Domain-Driven Design (DDD) principles. I need to integrate ASP.NET Core Identity for authentication and user management.
...
1
vote
2
answers
51
views
Visual Studio Pro 2022 React TS & ASP.NET Core Template Not Working from Creation
I am currently just learning to create websites and thought to use the existing Visual Studio Pro 2022 template to get started. I decided to go with the React TS & ASP.NET Core template and yet ...
-3
votes
1
answer
48
views
Referenced project error referencing package that doesn't exist
I'm getting this error in my production app class library:
Assembly 'SharedKernel' with identity 'SharedKernel, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.AspNetCore.Http....
1
vote
1
answer
72
views
Run `dotnet dev-certs http --trust` without showing user prompt
When I run
dotnet dev-certs http --trust
I see this message
Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously ...
0
votes
0
answers
44
views
Can't Target OpenAPI 3.x After Upgrading Swashbuckle.AspNetCore to v9.x
I'm trying to upgrade the Swashbuckle.AspNetCore package from version 7.3.2 to the latest version, which is currently 9.0.3, in an ASP.NET Core app targeting .NET 8. Note that this app will be ...
-1
votes
0
answers
90
views
Unable to cast object of type 'System.Int32' when trying to update data through a form [duplicate]
I'm currently following a tutorial on building an ASP.NET Core application with Razor forms, I was following the "Update" portion of the tutorial in which they give instructions on how to ...
0
votes
0
answers
37
views
ASP.NET Core and multiple cookies
I would like to provide two separate cookie based auth schemes in my app, one using my AuthenticationHandler I rolled out (not shown); an approach similar to this snippet.
However the ASP.NET Core ...