小编may*_*pta的帖子

找不到适合类型“RestDataService”的构造函数

运行 .Net Core 2.0 API 端点时出现以下错误。

找不到适合类型“RestDataService”的构造函数。确保类型是具体的,并且为公共构造函数的所有参数注册了服务。

 public partial class RestDataService : IRestDataService
    {
        private static HttpClient _client;
        private static AppConfiguration _configuration;
        private const short MaxRetryAttempts = 3;
        private const short TimeSpanToWait = 2;

        public RestDataService(AppConfiguration configuration)
        {
            _client = configuration.HttpClient;
            _configuration = configuration;
        }
........
Run Code Online (Sandbox Code Playgroud)

我的创业班是这样的:

  // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {

            var config = new AppConfiguration
            {
                Environment = Configuration["environment"],
            };

            services.AddMvc().AddJsonOptions(o …
Run Code Online (Sandbox Code Playgroud)

.net c# oop .net-core asp.net-core

7
推荐指数
4
解决办法
9857
查看次数

标签 统计

.net ×1

.net-core ×1

asp.net-core ×1

c# ×1

oop ×1