参考链接:https://www.cnblogs.com/king-23100/p/11821020.html
唯一的补充是在Startup.cs中注册服务时加上
services.AddScoped<ITestService, TestService>();