How to resolve Microsoft.Extensions.Hosting services error? - c#

I try to add migration in my EF Core 5 project. All entities are set up well. Unfortunately when I do add-migration InitialMigration then the following error occurs:
An error occurred while accessing the Microsoft.Extensions.Hosting
services. Continuing without the application service provider. Error:
Some services are not able to be constructed (Error while validating
the service descriptor 'ServiceType:
MediatR.IRequestHandler`2[TicketManagement.Application.Features.Events.Commands.CreateEvent.CreateEventCommand,System.Guid]
Lifetime: Transient ImplementationType:
TicketManagement.Application.Features.Events.Commands.CreateEvent.CreateEventCommandHandler':
Unable to resolve service for type
'TicketManagement.Application.Models.Mail.EmailSettings' while
attempting to activate
'TicketManagement.Infrastructure.Mail.EmailService'.) (Error while
validating the service descriptor 'ServiceType:
TicketManagement.Application.Contracts.Infrastructure.IEmailService
Lifetime: Transient ImplementationType:
TicketManagement.Infrastructure.Mail.EmailService': Unable to resolve
service for type
'TicketManagement.Application.Models.Mail.EmailSettings' while
attempting to activate
'TicketManagement.Infrastructure.Mail.EmailService'.)
I added all services to Startup.cs class.
public void ConfigureServices(IServiceCollection services)
{
services.AddApplicationServices();
services.AddPersistenceServices(Configuration);
services.AddInfrastructureServices(Configuration);
services.AddControllers();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "TicketManagement.Api", Version = "v1" });
});
services.AddCors(options =>
{
options.AddPolicy("Open", builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
});
}
WHat's the root cause of this kind of error?

You need to add EmailSettings to the service collection as EmailService does not know how to resolve the service.

Related

InvalidOperationException: Unable to resolve service for type "" while attempting to activate dotnet core 7

I try add
using SciEn.Repo.Contracts;
using SciEn.Repo.IRepository;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddSingleton<ISubDepartmentRepository, SubDepartmentRepository>();
var app = builder.Build();
I got this error
'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: SciEn.Repo.Contracts.ISubDepartmentRepository Lifetime: Scoped ImplementationType: SciEn.Repo.IRepository.SubDepartmentRepository': Unable to resolve service for type 'SciEn.Models.ScinceContext' while attempting to activate 'SciEn.Repo.IRepository.SubDepartmentRepository'.)'
I try remove
builder.Services.AddScoped<ISubDepartmentRepository, SubDepartmentRepository>();
but get error
InvalidOperationException: Unable to resolve service for type "" while attempting to activate
Unable to resolve service for type 'SciEn.Models.ScinceContext' while attempting to activate 'SciEn.Repo.IRepository.SubDepartmentRepository'.)
This error is telling you that when it tried to create the SubDepartmentRepository class it couldn't find the ScinceContext that needs to be injected into it's constructor.
You need to ensure you have registered the SciEn.Models.ScinceContext class.
Is this an Entity Framework DB Context? Make sure you've registered the DB Context...
builder.Services.AddDbContext<SciEn.models.ScinceContext>(...);
There are two things you need to care:
1.Create an instance of ScinceContext to pass into the SubDepartmentRepository.
2.Since DbContext is scoped by default, you need to create scope to access it.
Please check with your code something like below:
builder.Services.AddDbContext<ScinceContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("Connectionstring")));
builder.Services.AddScoped<ISubDepartmentRepository, SubDepartmentRepository>();
If you really need to use a dbContext inside a singleton, you can read this to know more.

What does AddEntityFrameworkStores exactly do in AddIdentity?

I recently needed to Generate Email Confirmation Token for my .net core 5 app, and while researching I found out I need to register "AddIdentity" at startup.
services.AddIdentity<AuthenticatedUser, IdentityRole>(options =>
{
options.User.RequireUniqueEmail = false;
}).
AddEntityFrameworkStores<SchoolDataContext>().
AddDefaultTokenProviders();
If I remove 'AddEntityFrameworkStores' piece, then application builds and starts but crashes at runtime with similar errors like in following:
Error:
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory1[WebApp1.Areas.Identity.Data.ApplicationUser] Lifetime: Scoped ImplementationType: WebApp1.Areas.Identity.Data.AdditionalUserClaimsPrincipalFactory': Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager1[WebApp1.Areas.Identity.Data.ApplicationUser]' while attempting to activate 'WebApp1.Areas.Identity.Data.AdditionalUserClaimsPrincipalFactory'.)'
My question is why we even need to register "AddEntityFrameworkStores", I could not found a good documentation or source code implementation of it. Can't we just avoid to use it, or any idea why we need it at first place?
Here's the source code.
Basically it adds default Stores: UserStore and RoleStore. If you don't use it you have to provide Stores yourself with AddUserStore and AddRoleStore.

Why does services.AddControllers().AddNewtonsoftJson() throws exception using .Net5 core

I have a problem when the following code executes line services.AddControllers().AddNewtonsoftJson() It throws this exception, if the line is removed the service executes fine it appears.
Some services are not able to be constructed (Error while validating
the service descriptor 'ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionInvokerFactory
Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ActionInvokerFactory':
No constructor for type 'Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerProvider' can be
instantiated using services from the service container and default values.) (Error while validating the
service descriptor 'ServiceType: Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider Lifetime:
Transient ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerProvider':
No constructor for type 'Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerProvider' can be
instantiated using services from the service container and default values.) (Error while validating the
service descriptor 'ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1
[Microsoft.AspNetCore.Mvc.VirtualFileResult] Lifetime: Singleton ImplementationType:
Microsoft.AspNetCore.Mvc.Infrastructure.VirtualFileResultExecutor':
Unable to resolve service for type 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment
' while attempting to activate 'Microsoft.AspNetCore.Mvc.Infrastructure.VirtualFileResultExecutor'.)
(Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Mvc.Routing.MvcRouteHandler
Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.MvcRouteHandler':
No constructor for type 'Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerProvider'
can be instantiated using services from the service container and default values.)
(Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Mvc.Routing.MvcAttributeRouteHandler
Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Routing.MvcAttributeRouteHandler':
No constructor for type 'Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerProvider'
can be instantiated using services from the service container and default values.)
I'm running under .Net5 and have the latest Microsoft.AspNetCore.Mvc.NewtonsoftJson package installed. Any ideas on why services.AddControllers().AddNewtonsoftJson() throws this error?
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.UseWindowsService()
.ConfigureServices((hostContext, services) =>
{
services.AddControllers().AddNewtonsoftJson();
services.AddHostedService<Service>();
}).UseSerilog();
}
Packages installed:
Microsoft.AspNetCore.Mvc.NewtonsoftJson
Microsoft.Extensions.ApiDescription.Client
Microsoft.Extensions.Hosting
Microsoft.Extensions.Hosting.WindowsServices
NSwag.ApiDescription.Client
Serilog.AspNetCore
Serilog.Sinks.RollingFile
System.ServiceModel.Http
System.ServiceModel.Primitives
This issue has nothing to do with the Newtonsoft extension.
You need to import the ASP.NET Core framework to use controllers:
Microsoft.AspNetCore.Hosting;
Microsoft.Extensions.Hosting;
Then use this extension method:
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
// ...
});
You are missing the ASP.NET Core runtimes, so it has no idea how to handle controllers.
What I would highly suggest you do (if you want controllers) is start over. When choosing your project type, choose "ASP.NET Core Website", then choose "Web API" as the type of website.
That will give you everything you need to run controllers.

dotnet quit unexpectedly - after creating new project in ASP.NET Core

I'm getting this warning while creating new MVC project using ASP.NET Core (both 3.1 version and 5.0 version):
dotnet quit unexpectedly
Because the warning description does show me where the problem comes from, so I don't know where to start.
This is my Startup.cs file:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapRazorPages();
});
}
}
Am I missing something?
There are multiple cases to get this warning. Some problem can be fixed inside the method ConfigureServices in the file Startup.cs.
If you are using Visual Studio, you can open Application Output tab (View -> Other Windows -> Application Output).
If you've got some message, such as:
Case 1:
Unhandled exception. System.InvalidOperationException: Unable to find
the required services. Please add all the required services by calling
'IServiceCollection.AddAuthorization' inside the call to
'ConfigureServices(...)' in the application startup code.
Fixed: Calling services.AddAuthorization(); method inside the ConfigureServices method.
Note: It's different from services.AddAuthentication(); (this service can be used when you want to enable some services like: Login with Facebook/Google/Twitter...).
Case 2:
Unhandled exception. System.InvalidOperationException: Unable to find
the required services. Please add all the required services by calling
'IServiceCollection.AddControllers' inside the call to
'ConfigureServices(...)' in the application startup code.
Fixed: Calling services.AddControllersWithViews(); or services.AddControllers(); service inside that method to solve the problem.
Case 3:
Unhandled exception. System.InvalidOperationException: Unable to find
the required services. Please add all the required services by calling
'IServiceCollection.AddRazorPages' inside the call to
'ConfigureServices(...)' in the application startup code.
This error ocurrs when you enable to use Razor Pages. To solve this problem, you need to add services.AddRazorPages(); service.
Case 4:
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: No service for type
'Microsoft.AspNetCore.Identity.UserManager`1[Microsoft.AspNetCore.Identity.IdentityUser]'
has been registered.
You've got this error when missing to add identity service. This can be done by one of these ways:
services.AddDefaultIdentity<IdentityUser>(options =>
{
//options.Password.RequireDigit = false;
//options.Password.RequiredLength = 8;
//options.Password.RequireLowercase = false;
//options.Password.RequireNonAlphanumeric = false;
//options.Password.RequireUppercase = false;
}).AddEntityFrameworkStores<ApplicationDbContext>();
or
services.AddIdentity<IdentityUser, IdentityRole>(options =>
{
//options.Password.RequireDigit = false;
//options.Password.RequiredLength = 8;
//options.Password.RequireLowercase = false;
//options.Password.RequireNonAlphanumeric = false;
//options.Password.RequireUppercase = false;
}).AddEntityFrameworkStores<ApplicationDbContext>();
If you want to extend IdentityUser class to add more property like LastSignedIn:
public class User : IdentityUser
{
public DateTimeOffset LastSignedIn { get; set; }
}
you can replace IdentityUser with User when adding identity service:
services.AddIdentity<User, IdentityRole>(options => {})
.AddEntityFrameworkStores<ApplicationDbContext>();
Case 5:
Unhandled exception. System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.IUserClaimsPrincipalFactory1[Microsoft.AspNetCore.Identity.IdentityUser] Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.UserClaimsPrincipalFactory1[Microsoft.AspNetCore.Identity.IdentityUser]': Unable to resolve service for type 'X.Data.ApplicationDbContext' while attempting to activate 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserOnlyStore6[Microsoft.AspNetCore.Identity.IdentityUser,X.Data.ApplicationDbContext,System.String,Microsoft.AspNetCore.Identity.IdentityUserClaim1[System.String],Microsoft.AspNetCore.Identity.IdentityUserLogin1[System.String],Microsoft.AspNetCore.Identity.IdentityUserToken1[System.String]]'.) (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.UserManager1[Microsoft.AspNetCore.Identity.IdentityUser] Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.UserManager1[Microsoft.AspNetCore.Identity.IdentityUser]': Unable to resolve service for type 'X.Data.ApplicationDbContext' while attempting to activate 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserOnlyStore6[Microsoft.AspNetCore.Identity.IdentityUser,X.Data.ApplicationDbContext,System.String,Microsoft.AspNetCore.Identity.IdentityUserClaim1[System.String],Microsoft.AspNetCore.Identity.IdentityUserLogin1[System.String],Microsoft.AspNetCore.Identity.IdentityUserToken1[System.String]]'.) (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.ISecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.SecurityStampValidator1[Microsoft.AspNetCore.Identity.IdentityUser]': Unable to resolve service for type 'X.Data.ApplicationDbContext' while attempting to activate 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserOnlyStore6[Microsoft.AspNetCore.Identity.IdentityUser,X.Data.ApplicationDbContext,System.String,Microsoft.AspNetCore.Identity.IdentityUserClaim1[System.String],Microsoft.AspNetCore.Identity.IdentityUserLogin1[System.String],Microsoft.AspNetCore.Identity.IdentityUserToken1[System.String]]'.) (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.ITwoFactorSecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.TwoFactorSecurityStampValidator1[Microsoft.AspNetCore.Identity.IdentityUser]': Unable to resolve service for type 'X.Data.ApplicationDbContext' while attempting to activate 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserOnlyStore6[Microsoft.AspNetCore.Identity.IdentityUser,X.Data.ApplicationDbContext,System.String,Microsoft.AspNetCore.Identity.IdentityUserClaim1[System.String],Microsoft.AspNetCore.Identity.IdentityUserLogin1[System.String],Microsoft.AspNetCore.Identity.IdentityUserToken1[System.String]]'.) (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.SignInManager1[Microsoft.AspNetCore.Identity.IdentityUser] Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.SignInManager1[Microsoft.AspNetCore.Identity.IdentityUser]': Unable to resolve service for type 'X.Data.ApplicationDbContext' while attempting to activate 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserOnlyStore6[Microsoft.AspNetCore.Identity.IdentityUser,X.Data.ApplicationDbContext,System.String,Microsoft.AspNetCore.Identity.IdentityUserClaim1[System.String],Microsoft.AspNetCore.Identity.IdentityUserLogin1[System.String],Microsoft.AspNetCore.Identity.IdentityUserToken1[System.String]]'.) (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.IUserStore1[Microsoft.AspNetCore.Identity.IdentityUser] Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserOnlyStore6[Microsoft.AspNetCore.Identity.IdentityUser,X.Data.ApplicationDbContext,System.String,Microsoft.AspNetCore.Identity.IdentityUserClaim1[System.String],Microsoft.AspNetCore.Identity.IdentityUserLogin1[System.String],Microsoft.AspNetCore.Identity.IdentityUserToken1[System.String]]': Unable to resolve service for type 'X.Data.ApplicationDbContext' while attempting to activate 'Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserOnlyStore6[Microsoft.AspNetCore.Identity.IdentityUser,X.Data.ApplicationDbContext,System.String,Microsoft.AspNetCore.Identity.IdentityUserClaim1[System.String],Microsoft.AspNetCore.Identity.IdentityUserLogin1[System.String],Microsoft.AspNetCore.Identity.IdentityUserToken`1[System.String]]'.)
This error ocurrs when you forget to enabling DbContext service:
// in this example, we use "Sqlite" to manage connection
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));
If you want to use SQL Server instead of Sqlite, you can add Microsoft.EntityFrameworkCore.SqlServer NPM package:
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
If you define ApplicationDbContext class in the class library project (Namespace: Your_main_project_namespace.Data), when you refer it to the main project, you need to call MigrationsAssembly method with the namspace name of the main project:
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
actions => actions.MigrationsAssembly("Your_main_project_namespace")));
Note: The current version (5.0.0) of this package is applied to net5.0, so if you're using netcoreapp3.1, you can use version 3.1.10 instead. Don't try to upgrade to the lastest, it will crash your project. Such as: removing/replacing some obsolete method/class/interface... (IWebHostEnvironment vs IHostingEnvironment...).
Case 6:
Value cannot be null. (Parameter 'connectionString')
This error may come from your connection string name in the file appsettings.json:
{
"ConnectionStrings": {
"MyConnection": "DataSource=app.db;Cache=Shared"
}
}
In this example, we name the connection string with the name MyConnection, so when we try to get:
Configuration.GetConnectionString("DefaultConnection")
the exception will be thrown because there is no property name DefaultConnection.
Case 7:
This problem may come from the way to append a large of data files to project via copy-paste method using Finder (on Mac) or Explorer (on Windows). The general case is: Coping to wwwroot folder:
When Visual Studio is opening and some files are copied to wwwroot folder (or somewhere else in the project) successful, the project will be saved automatically. There is no way to stop it.
And the remaining time will be calculated based on:
File count,
file size,
file type,
the target folder (wwwroot, node_modules...),
and your hardware (CPU, RAM, HDD or SSD).
So, be careful if you want to copy more than 5000 images or videos to wwwroot folder. If something goes wrong (I don't even know where the error comes from), you cannot run the project. In this case, I suggest:
Wait until your project completes saving/loading/restoring. DO NOT take any action to try to stop or prevent it.
Right click the project and choose Edit Project File to edit .csproj file. In this file, if you catch some implementation like this:
<ItemGroup>
<Content Include="wwwroot\">
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</Content>
</ItemGroup>
The tag <ItemGroup> which contains <Content> tag, and the <Content> tag mentions about wwwroot folder or some folder name that inherits from wwwroot folder. DELETE all of them (including the parent tag: <ItemGroup>), save the file and wait until the file is saved/all packages are restored.
Clean the project and buid/rebuild again.
More action: If the building/loading speed of your project becomes very slow, try to right click on the target folder (in this case: wwwroot) and choose Exclude From Project. Then waiting until Visual Studio completes the action, and right click the folder to choose Include From Project again. Waiting action is required (the time to exclude/include may the same).

Asp.net core 3.0 how to register custom model binder

I'm trying to register a custom model binder in ASP.NET Core 3.0 startup.cs based on the following examples:
Link 1
Link 2
The code below is not working, can someone please help - thanks!
services.AddMvc()
.AddMvcOptions(options =>
{
IHttpRequestStreamReaderFactory readerFactory = services.BuildServiceProvider().GetRequiredService<IHttpRequestStreamReaderFactory>();
options.ModelBinderProviders.Insert(0, new NtBodyModelBinderProvider(options.InputFormatters, readerFactory));
});
I'm getting the following error when I try to run the application:
System.AggregateException
HResult=0x80131500
Message=Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider Lifetime: Scoped ImplementationType: CustomerCash.External.Api.ModelBinders.NtBodyModelBinderProvider': Unable to resolve service for type 'System.Collections.Generic.IList`1[Microsoft.AspNetCore.Mvc.Formatters.IInputFormatter]' while attempting to activate 'CustomerCash.External.Api.ModelBinders.NtBodyModelBinderProvider'.) (Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder Lifetime: Scoped ImplementationType: CustomerCash.External.Api.ModelBinders.NtBodyModelBinder': Unable to resolve service for type 'System.Collections.Generic.IList`1[Microsoft.AspNetCore.Mvc.Formatters.IInputFormatter]' while attempting to activate 'CustomerCash.External.Api.ModelBinders.NtBodyModelBinder'.)
Source=Microsoft.Extensions.DependencyInjection
StackTrace:
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable`1 serviceDescriptors, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
at Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder)
at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at CustomerCash.External.Api.Program.Main(String[] args) in C:\Development\JamesHay\jhcode\CustomerCashExternal\src\CustomerCash.External.Api\Program.cs:line 11
This exception was originally thrown at this call stack:
Inner Exception 1:
InvalidOperationException: Error while validating the service descriptor '
ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider
Lifetime: Scoped
ImplementationType: CustomerCash.External.Api.ModelBinders.NtBodyModelBinderProvider':
Unable to resolve service for type 'System.Collections.Generic.IList`1[Microsoft.AspNetCore.Mvc.Formatters.IInputFormatter]' while attempting to activate 'CustomerCash.External.Api.ModelBinders.NtBodyModelBinderProvider'.
Inner Exception 2:
InvalidOperationException: Unable to resolve service for type 'System.Collections.Generic.IList`1[Microsoft.AspNetCore.Mvc.Formatters.IInputFormatter]' while attempting to activate 'CustomerCash.External.Api.ModelBinders.NtBodyModelBinderProvider'.

Categories