专门做进口产品的网站6,wordpress特定用户特定分类,产品推广渠道有哪些方式,wordpress企业宣传电商简介CondenserDotNet - 使用 Kestrel 和 Consul 的 API 反向代理库#xff01;特点•Consul 客户端库#xff0c;包括服务注册、发现和配置•反向代理•交互式 UI#xff0c;用于查看有关代理的统计信息配置示例配置遵循 LIFO 策略#xff0c;以最后注册的配置为准var conf… 简介CondenserDotNet - 使用 Kestrel 和 Consul 的 API 反向代理库特点•Consul 客户端库包括服务注册、发现和配置•反向代理•交互式 UI用于查看有关代理的统计信息配置示例配置遵循 LIFO 策略以最后注册的配置为准var configValue configRegistry[MyKey];如果密钥不存在它将引发异常。您也可以使用普通的 tryget 模式访问它if(configRegistry.TryGetValue(MyKey, out string configValue))
{//do something with the key
}静态配置要注册一组静态键,请使用以下代码var result await configRegistry.AddStaticKeyPathAsync(my/keys/path);动态配置可以注册动态配置的关键路径,代码如下var registry new ConsulRegistry();await registry.AddUpdatingPathAsync(org/test5/);还可以注册回调以提醒您是否更新了特定键或配置中的任何键是否已更新。var singleCallBack registry.AddWatchOnSingleKey(test1, () Console.Writeline(Key Changed!);如果您想要任何更新来触发您的回调只需执行var multipleCallBack registry.AddWatchOnEntireConfig(() Console.Writeline(Some key changed, or multiple keys changed, or maybe none?);请求服务获取要连接的服务实例的示例var serviceInstance await serviceRegistry.GetServiceInstanceAsync(ServiceLookup);
if(serviceInsance null)
{//you need to handle no service instance available
}
//connect to service via your method
var serverUrl $http://{serviceInstance.Address}:{serviceInsance.Port};//your method for calling servers服务端口在动态端口上配置 Kestrel 的示例var host new WebHostBuilder().UseKestrel().UseUrls($http://*:{ServiceManagerOptions.GetNextAvailablePort()}).UseStartupStartup().Build();host.Run();服务注册在动态端口上配置 Kestrel 的示例var host new WebHostBuilder().UseKestrel().UseUrls($http://*:{serviceManager.ServicePort}).UseStartupStartup().Build();host.Run();Github地址https://github.com/Drawaes/CondenserDotNet最后大家如果喜欢我的文章还麻烦给个关注并点个赞, 希望net生态圈越来越好