.NetCore中的services.AddTransient和services.AddScoped

 

报:

"Unable to resolve service for type xxxx IService

while attempting to activate XXX Controller"

Startup中ConfigureServices添加:

services.AddTransient<IUserStorage, UserStorage>();
services.AddScoped<IUserService, UserService>();

OK..

posted @ 2021-09-26 17:39  Raywang80s  阅读(494)  评论(0编辑  收藏  举报