.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>();

posted @ 2021-10-13 10:25  simadi  阅读(150)  评论(0编辑  收藏  举报