当前位置: 首页 > news >正文

个人网站工商备案网上商城功能模块图

个人网站工商备案,网上商城功能模块图,wordpress 获取文章类型,广东网站建设专业公司排名背景Polly是一个.NET弹性和瞬态故障处理库#xff0c;允许开发人员以流畅和线程安全的方式表达诸如重试#xff0c;断路器#xff0c;超时#xff0c;隔离头和回退之类的策略。Polly面向.NET Standard 1.1#xff08;覆盖范围#xff1a;.NET Core 1.0#xff0c;Mono允许开发人员以流畅和线程安全的方式表达诸如重试断路器超时隔离头和回退之类的策略。Polly面向.NET Standard 1.1覆盖范围.NET Core 1.0MonoXamarinUWPWP8.1 和.NET Standard 2.0覆盖范围.NET Core 2.0 、. NET Core 3.0和更高版本的MonoXamarin和UWP目标。nuget软件包还包括.NET Framework 4.6.1和4.7.2的直接目标。使用方式通过NuGet安装Install-Package Polly 代码实现故障处理响应策略故障处理策略处理您通过策略执行的委托引发的特定异常或          返回的结果。  步骤1指定您希望策略处理的异常/错误// Single exception type Policy.HandleHttpRequestException()// Single exception type with condition Policy.HandleSqlException(ex ex.Number 1205)// Multiple exception types Policy.HandleHttpRequestException().OrOperationCanceledException()// Multiple exception types with condition Policy.HandleSqlException(ex ex.Number 1205).OrArgumentException(ex ex.ParamName example)// Inner exceptions of ordinary exceptions or AggregateException, with or without conditions // (HandleInner matches exceptions at both the top-level and inner exceptions) Policy.HandleInnerHttpRequestException().OrInnerOperationCanceledException(ex ex.CancellationToken ! myToken) 步骤2指定策略应如何处理这些故障2.1、重试‍// Retry once Policy.HandleSomeExceptionType().Retry()// Retry multiple times Policy.HandleSomeExceptionType().Retry(3)// Retry multiple times, calling an action on each retry // with the current exception and retry count Policy.HandleSomeExceptionType().Retry(3, onRetry: (exception, retryCount) {// Add logic to be executed before each retry, such as logging});// Retry multiple times, calling an action on each retry // with the current exception, retry count and context // provided to Execute() Policy.HandleSomeExceptionType().Retry(3, onRetry: (exception, retryCount, context) {// Add logic to be executed before each retry, such as logging }); 2.2、永远重试直到成功// Retry forever Policy.HandleSomeExceptionType().RetryForever()// Retry forever, calling an action on each retry with the // current exception Policy.HandleSomeExceptionType().RetryForever(onRetry: exception {// Add logic to be executed before each retry, such as logging });// Retry forever, calling an action on each retry with the // current exception and context provided to Execute() Policy.HandleSomeExceptionType().RetryForever(onRetry: (exception, context) {// Add logic to be executed before each retry, such as logging }); 2.3、等待并重试// Retry, waiting a specified duration between each retry. // (The wait is imposed on catching the failure, before making the next try.) Policy.HandleSomeExceptionType().WaitAndRetry(new[]{TimeSpan.FromSeconds(1),TimeSpan.FromSeconds(2),TimeSpan.FromSeconds(3)});// Retry, waiting a specified duration between each retry, // calling an action on each retry with the current exception // and duration Policy.HandleSomeExceptionType().WaitAndRetry(new[]{TimeSpan.FromSeconds(1),TimeSpan.FromSeconds(2),TimeSpan.FromSeconds(3)}, (exception, timeSpan) {// Add logic to be executed before each retry, such as logging }); // Retry, waiting a specified duration between each retry, // calling an action on each retry with the current exception, // duration and context provided to Execute() Policy.HandleSomeExceptionType().WaitAndRetry(new[]{TimeSpan.FromSeconds(1),TimeSpan.FromSeconds(2),TimeSpan.FromSeconds(3)}, (exception, timeSpan, context) {// Add logic to be executed before each retry, such as logging });// Retry, waiting a specified duration between each retry, // calling an action on each retry with the current exception, // duration, retry count, and context provided to Execute() Policy.HandleSomeExceptionType().WaitAndRetry(new[]{TimeSpan.FromSeconds(1),TimeSpan.FromSeconds(2),TimeSpan.FromSeconds(3)}, (exception, timeSpan, retryCount, context) {// Add logic to be executed before each retry, such as logging });// Retry a specified number of times, using a function to // calculate the duration to wait between retries based on // the current retry attempt (allows for exponential backoff) // In this case will wait for // 2 ^ 1 2 seconds then // 2 ^ 2 4 seconds then // 2 ^ 3 8 seconds then // 2 ^ 4 16 seconds then // 2 ^ 5 32 seconds Policy.HandleSomeExceptionType().WaitAndRetry(5, retryAttempt TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)) );// Retry a specified number of times, using a function to // calculate the duration to wait between retries based on // the current retry attempt, calling an action on each retry // with the current exception, duration and context provided // to Execute() Policy.HandleSomeExceptionType().WaitAndRetry(5, retryAttempt TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (exception, timeSpan, context) {// Add logic to be executed before each retry, such as logging});// Retry a specified number of times, using a function to // calculate the duration to wait between retries based on // the current retry attempt, calling an action on each retry // with the current exception, duration, retry count, and context // provided to Execute() Policy.HandleSomeExceptionType().WaitAndRetry(5, retryAttempt TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (exception, timeSpan, retryCount, context) {// Add logic to be executed before each retry, such as logging}); 开源地址https://github.com/App-vNext/Polly
http://www.yutouwan.com/news/388339/

相关文章:

  • 广州shopify代建站徐州做网站的公司招聘
  • 注册网站时跳过验证码现在流行什么做网站
  • 海南电商网站建设有创意的电商公司名字大全
  • 北京 代理前置审批 网站备案香奈儿网站建设的目标
  • 怎样拍照产品做网站沃尔玛网上商城叫什么
  • 阿里云建站后台建站asp网站打开
  • 福州网站建设设计公司安康网站建设公司价格
  • 建设asp网站视频教程宣传软文模板
  • 常州城乡建设局网站怎么做游戏代理
  • 番禺响应式网站建设武功县住房和城乡建设局官网站
  • 网站建设如果登录失败做招聘网站需要什么人员
  • 做普工招聘网站网站导航栏兼容性
  • 佛山高端网站兰州网站建设运营方案
  • 这样做自己公司的网站wordpress删除模板文件夹
  • 国内做服装的网站有哪些商务卫士包括网站建设
  • 搜索网站logo怎么做自己做网站花钱吗
  • 如何保存自己做的网站虚拟主机销售网站源码
  • 什么是推广型网站设计制作生态瓶
  • 龙岩网站建设运营网站公司网站搭建
  • 建站公司服务深圳 网站
  • 一个帮你赚钱的网站是谁做的广告西充建设部门投诉网站
  • 中山建网站咨询电话网站设计风格升级
  • 做网站什么软件好合肥市住房建设局网站
  • 信息技术会考做网站做网站时图片要切片有什么作用
  • 厦门做网站多少钱建设项目验收公示网站
  • 厦门旅游网站建设目的做网站学哪方面知识
  • 荷城网站制作网站发展趋势
  • 做女装的看哪个网站好wordpress虾米音乐插件
  • 网站设计师网站wordpress改
  • 网站开发众筹做网页需要什么软件