.net core InvalidOperationException: Unable to resolve service for type while attempting to activate

问题:

InvalidOperationException: Unable to resolve service for type 'WebApplication3.Models.SysUserDB' while attempting to activate 'WebApplication3.Controllers.SysUsersController'.

解决办法:

Startup.cs

ConfigureServices方法内添加

services.AddTransient<WebApplication3.Models.SysUserDB>();

原文地址:https://www.cnblogs.com/simadi/p/15400945.html