C
C#ThePuppetMaster

System.InvalidOperationException: Unable to resolve service for type 'MovieApi_backend.database.Cont

when i connect my application to database postgresql and when i hit the post req getting error can some one help me this System.InvalidOperationException: Unable to resolve service for type 'MovieApi_backend.database.Context' while attempting to activate 'MoviesController'. at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ThrowHelperUnableToResolveService(Type type, Type requiredBy) at lambda_method9(Closure, IServiceProvider, Object[]) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>cDisplayClass6_0.<CreateControllerFactory>gCreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>gAwaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>gAwaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
No description
No description
T
ThePuppetMaster15d ago
No description
J
Jimmacle15d ago
that startup class looks wrong, there is no request pipeline configuration show your Program.cs
T
ThePuppetMaster15d ago
No description
J
Jimmacle15d ago
given that code, how do you suppose your startup class code is being called? why do you have a startup class in the first place?
T
ThePuppetMaster15d ago
Thanks bro it working i have add the database class in the Program.cs file and one more thing how can i improve the code like remove unnecessary class or code
J
Jimmacle15d ago
remove the Startup class if you haven't already, besides that you haven't shown much code so i can't really tell you and learn to use the debugger instead of putting Console.WriteLine everywhere $debug
M
MODiX15d ago
Tutorial: Debug C# code and inspect data - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
T
ThePuppetMaster14d ago
thnaks
Want results from more Discord servers?
Add your server
More Posts
data update error in c# sqlI want to change the password of the user in the database. I get the password changed warning on theASP Core 8 - Custom 404 HandlingI have a few scenarios where I need to show a different kind of view and a bit of different logic deAdd suffix to version without it showing up as a prereleaseI'm writing a lib that wraps a bunch of external GRPC APIs and exposes them via the same interface. Help refactor serviceHi! I have data of many `Station` models. Their information updates every ~60 minutes. I need to sto✅ looking for help/contributorsDotmenu is a straightforward console menu library designed to streamline user interactions in consolHow to find relative file path for file inside of project?Dealing with a C# console application, I have a folder inside the project named Files and inside thaPassing parameters to overloaded constructorHow would I pass the texture2D variable to be handled in the second constructor. Obviously return doI am trying to store data in database using EF my code run fine but its not storing dataif (response.IsSuccessStatusCode) { var json = await resUsing ref for large data types.Hi, just looking for a little clarification on the *ref* keyword when passing data into a function. crud operations with blazor serverI have a backend that I built and now I want to use it with api calls. I created same model with bacminor glitch, player twitchingso i have a glitch where the player starts "twitching" when you walk beside a block or just on a blo✅ BackgroundWorker getting progressI have a winform applications and with this I have put a ProgressBar on it. I was manually changing My tech stack, what to focus now?- .NET Core - Entity Framework Core (Code First) - MVC - Web API - Identity and JWT - Mediator & CQRBuild Issue due to $(Platform) valueWe are facing build issue when we try to build .net project in custom project configuration, like DePFX certificate for signing the application packageI am trying to use a certificate from azure key vault, but it says that it is invalid or another reaInheritance best practice: test Type of subclass or use enum?See attched UML. Just wondering what the best practice is? Is it better to test the Type of BaseEffeC# - Oracle DataBase Converting the Date (Oracle) to a c# DateTime PropertyHow can I replace TO_TIMESTAMP in my select query with the format my c# code uses? I have a class wiAdding Multitenancy through Finbuckel in the single tenant Dotnet applicationHey I was just implementing the Multitenancy to my existing single tenant dotnet application where oI need help with Deployment LogicSo let's say I have 10 servers (already setup with a load balancer and all that stuff) which all runFilesystem packer slows down after 30k filesAfter the filesystem packer has hashed all 255k files then the DB operations starts to slow down the