/// <summary> /// 添加基本Consul /// </summary> /// <param name="services">服务</param> /// <param name="consulBasic">Consul基本配置</param> /// <returns>服务</returns> public static IServiceCollection AddBasicConsul(this IServiceCollection services, ConsulBasicOption consulBasic) { var jsonStr = JsonUtil.SerializeIgnoreNull(consulBasic); using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(jsonStr))) { var config = new ConfigurationBuilder().AddJsonStream(stream).Build(); services.Configure <ConsulBasicOption>(config); } return(services); }