AspDotNetCore: ConfigurationBuilderCachePart не имеет определения для WithMicrosoftLogging - PullRequest
0 голосов
/ 20 мая 2019

Привет. Я пытаюсь создать шлюзы API и запустить несколько фиктивных сервисов без использования докеров.Я получил пример кода онлайн и хочу его запустить.в моем файле startup.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Ocelot.Middleware;
using Ocelot.DependencyInjection;
using CacheManager.Core;

namespace Ebooking.Platform.APIGateway
{
    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public Startup(IHostingEnvironment env)
        {
            var builder = new Microsoft.Extensions.Configuration.ConfigurationBuilder();
            builder.SetBasePath(env.ContentRootPath)
                   //add configuration.json  
                   .AddJsonFile("configuration.json", optional: false, reloadOnChange: true)
                   .AddEnvironmentVariables();

            Configuration = builder.Build();
        }
        public IConfigurationRoot Configuration { get; }

        public void ConfigureServices(IServiceCollection services)
        {
            
            Action<ConfigurationBuilderCachePart> settings = (x) =>
            {
                x.WithMicrosoftLogging(log =>
                {
                    log.AddConsole(LogLevel.Debug);

                }).WithDictionaryHandle();
            };
            services.AddOcelot(Configuration);
        }

        public async void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            await app.UseOcelot();
        }

    }
}

Я получаю сообщение об ошибке

 ConfigurationBuilderCachePart does not have a definition for WithMicrosoftLogging

Кто-нибудь знает, как я могу преодолеть эту ошибку.С другой стороны, ocelot запускает мои другие контроллеры, делая их доступными для api-шлюза?

...