.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..

原文地址:https://www.cnblogs.com/Raywang80s/p/15339233.html