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

网站建设捌金手指花总十一网站底部版权怎么做

网站建设捌金手指花总十一,网站底部版权怎么做,wordpress搭建电子商城,运营管理八个模块服务调用是什么在分布式应用程序中的服务之间进行调用会涉及到许多挑战。例如#xff1a;维护其他服务的地址。如何安全地调用服务。在发生短暂的 暂时性错误 时如何处理重试。分布式应用程序调用链路追踪。服务调用构建块通过使用 Dapr 挎斗作为服务的 反向代理 来解决这些难… 服务调用是什么在分布式应用程序中的服务之间进行调用会涉及到许多挑战。例如维护其他服务的地址。如何安全地调用服务。在发生短暂的 暂时性错误 时如何处理重试。分布式应用程序调用链路追踪。服务调用构建块通过使用 Dapr 挎斗作为服务的 反向代理 来解决这些难题。工作原理由于调用经过SidecarDapr 可以注入一些有其他行为失败时自动重试调用。通过相互 (mTLS) 身份验证包括自动证书滚动更新在服务之间进行调用。使用访问控制策略控制客户端可以执行的操作。捕获服务间所有调用的跟踪和指标以提供分布式调用链路追踪与诊断。任何应用程序都可以通过使用 Dapr 中内置的本机 Invoke API 来调用 Dapr Sidecar。可以通过 HTTP 或 gRPC 调用 API。使用以下 URL 调用 HTTP APIhttp://localhost:dapr-port/v1.0/invoke/application-id/method/method-namedapr-port Dapr 正在侦听的 HTTP 端口。application-id 要调用的服务的应用程序 ID。method-name 要在远程服务上调用的方法的名称。项目演示我们使用.NET5创建两个WebAPI项目BackEnd和FrontEnd通过FrontEnd调用BackEnd指定BackEnd默认启动端口5000public static IHostBuilder CreateHostBuilder(string[] args) Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder {webBuilder.UseStartupStartup().UseUrls(http://*:5000);});通过Dapr CLI启动BackEnd指定sidecar端口为3511默认为3500指定app-port是5000与BackEnd默认端口保持一致dapr run --dapr-http-port 3511 --app-port 5000 --app-id backend dotnet .\BackEnd\bin\Debug\net5.0\BackEnd.dllC:\demo\test\DaprBackEnddapr run --dapr-http-port 3511 --app-port 5000 --app-id backend dotnet .\BackEnd\bin\Debug\net5.0\BackEnd.dll Starting Dapr with id backend. HTTP Port: 3511. gRPC Port: 30204 time2021-09-23T14:14:08.378542908:00 levelinfo msgstarting Dapr Runtime -- version 1.4.0 -- commit ed969edc72b3934fffb481f079b736f3588e373a app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.383108908:00 levelinfo msglog level set to: info app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.383108908:00 levelinfo msgmetrics server started on :30205/ app_idbackend instancechesterchen-lap scopedapr.metrics typelog ver1.4.0 time2021-09-23T14:14:08.386120308:00 levelinfo msgstandalone mode configured app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.386120308:00 levelinfo msgapp id: backend app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.387110708:00 levelinfo msgmTLS is disabled. Skipping certificate request and tls validation app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.411568108:00 levelinfo msglocal service entry announced: backend - 10.32.193.9:30209 app_idbackend instancechesterchen-lap scopedapr.contrib typelog ver1.4.0 time2021-09-23T14:14:08.411568108:00 levelinfo msgInitialized name resolution to mdns app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.412702408:00 levelinfo msgloading components app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.416022408:00 levelinfo msgcomponent loaded. name: pubsub, type: pubsub.redis/v1 app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.416022408:00 levelinfo msgwaiting for all outstanding components to be processed app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.418704208:00 levelinfo msgcomponent loaded. name: statestore, type: state.redis/v1 app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.418704208:00 levelinfo msgall outstanding components processed app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.419248608:00 levelinfo msgenabled gRPC tracing middleware app_idbackend instancechesterchen-lap scopedapr.runtime.grpc.api typelog ver1.4.0 time2021-09-23T14:14:08.419248608:00 levelinfo msgenabled gRPC metrics middleware app_idbackend instancechesterchen-lap scopedapr.runtime.grpc.api typelog ver1.4.0 time2021-09-23T14:14:08.419248608:00 levelinfo msgAPI gRPC server is running on port 30204 app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.419788808:00 levelinfo msgenabled metrics http middleware app_idbackend instancechesterchen-lap scopedapr.runtime.http typelog ver1.4.0 time2021-09-23T14:14:08.419788808:00 levelinfo msgenabled tracing http middleware app_idbackend instancechesterchen-lap scopedapr.runtime.http typelog ver1.4.0 time2021-09-23T14:14:08.420295408:00 levelinfo msghttp server is running on port 3511 app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.42033508:00 levelinfo msgThe request body size parameter is: 4 app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.42033508:00 levelinfo msgenabled gRPC tracing middleware app_idbackend instancechesterchen-lap scopedapr.runtime.grpc.internal typelog ver1.4.0 time2021-09-23T14:14:08.422540308:00 levelinfo msgenabled gRPC metrics middleware app_idbackend instancechesterchen-lap scopedapr.runtime.grpc.internal typelog ver1.4.0 time2021-09-23T14:14:08.423086808:00 levelinfo msginternal gRPC server is running on port 30209 app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.423086808:00 levelinfo msgapplication protocol: http. waiting on port 5000. This will block until the app is listening on that port. app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0APP info: Microsoft.Hosting.Lifetime[0]APP Now listening on: http://[::]:5000APP info: Microsoft.Hosting.Lifetime[0]APP Application started. Press CtrlC to shut down.APP info: Microsoft.Hosting.Lifetime[0]APP Hosting environment: ProductionAPP info: Microsoft.Hosting.Lifetime[0]APP Content root path: C:\demo\test\DaprBackEnd time2021-09-23T14:14:08.725268108:00 levelinfo msgapplication discovered on port 5000 app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0APP info: Microsoft.AspNetCore.Hosting.Diagnostics[1]APP Request starting HTTP/1.1 GET http://127.0.0.1:5000/dapr/config application/json -APP info: Microsoft.AspNetCore.Hosting.Diagnostics[2]APP Request finished HTTP/1.1 GET http://127.0.0.1:5000/dapr/config application/json - - 404 0 - 17.3850ms time2021-09-23T14:14:08.769364908:00 levelinfo msgapplication configuration loaded app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:14:08.769900308:00 levelinfo msgactor runtime started. actor idle timeout: 1h0m0s. actor scan interval: 30s app_idbackend instancechesterchen-lap scopedapr.runtime.actor typelog ver1.4.0APP info: Microsoft.AspNetCore.Hosting.Diagnostics[1]APP Request starting HTTP/1.1 GET http://127.0.0.1:5000/dapr/subscribe application/json -APP info: Microsoft.AspNetCore.Hosting.Diagnostics[2] time2021-09-23T14:14:08.773638308:00 levelinfo msgdapr initialized. Status: Running. Init Elapsed 387.518ms app_idbackend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0APP Request finished HTTP/1.1 GET http://127.0.0.1:5000/dapr/subscribe application/json - - 404 0 - 0.1789ms time2021-09-23T14:14:08.788844408:00 levelinfo msgplacement tables updated, version: 0 app_idbackend instancechesterchen-lap scopedapr.runtime.actor.internal.placement typelog ver1.4.0 Updating metadata for app command: dotnet .\BackEnd\bin\Debug\net5.0\BackEnd.dll Youre up and running! Both Dapr and your app logs will appear here.现在修改FrontEnd里Demo指定启动端口5001public static IHostBuilder CreateHostBuilder(string[] args) Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder {webBuilder.UseStartupStartup().UseUrls(http://*:5001);});引入Nuget包 Dapr.Client新建DaprController1.使用 HttpClient调用HTTP服务using Dapr.Client;using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging;using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks;namespace FrontEnd.Controllers {[ApiController][Route([controller])]public class DaprController : ControllerBase{private readonly ILoggerDaprController _logger;public DaprController(ILoggerDaprController logger){_logger logger;}// 通过HttpClient调用BackEnd[HttpGet]public async TaskActionResult GetAsync(){using var httpClient DaprClient.CreateInvokeHttpClient();var result await httpClient.GetAsync(http://backend/WeatherForecast);var resultContent string.Format(result is {0} {1}, result.StatusCode, await result.Content.ReadAsStringAsync());return Ok(resultContent);}} }GetAsync API中通过DaprClient.CreateInvokeHttpClient()新建了HttpClient,通过GetAsync方法调用了backend服务中的WeatherForecastAPI。Sidecar使用可插接式名称解析组件来解析服务BackEnd的地址。在自承载模式下Dapr 使用 mdn 来查找它。在 Kubernetes 模式下运行时Kubernetes DNS 服务将确定地址。2.使用 DaprClient调用HTTP服务// 通过DaprClient调用BackEnd[HttpGet(get2)]public async TaskActionResult Get2Async(){using var daprClient new DaprClientBuilder().Build();var result await daprClient.InvokeMethodAsyncIEnumerableWeatherForecast(HttpMethod.Get, backend, WeatherForecast);return Ok(result);}DaprController中新增API Get2Async 3.使用注入方式调用 DaprClient首先引入Nuget包Dapr.AspNetCore然后在Startup.cs注入Daprpublic void ConfigureServices(IServiceCollection services){services.AddControllers().AddDapr();}新建DaprDIControllerusing Dapr.Client;using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging;using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks;namespace FrontEnd.Controllers {[Route([controller])][ApiController]public class DaprDIController : ControllerBase{private readonly ILoggerDaprDIController _logger;private readonly DaprClient _daprClient;public DaprDIController(ILoggerDaprDIController logger, DaprClient daprClient){_logger logger;_daprClient daprClient;}[HttpGet()]public async TaskActionResult GetAsync(){var result await _daprClient.InvokeMethodAsyncIEnumerableWeatherForecast(HttpMethod.Get, backend, WeatherForecast);return Ok(result);}} }以上代码通过注入方式注入DaprClient4.使用DaprClient同样可以调用GRPCawait daprClient.InvokeMethodGrpcAsyncOrder, OrderConfirmation(orderservice, submitOrder, order);与HTTP调用方式一致不再为GRPC新建server通过Dapr CLI启动FrontEnd指定sidecar端口为3501默认为3500指定app-port是5001与FrontEnd默认端口保持一致dapr run --dapr-http-port 3501 --app-port 5001 --app-id frontend dotnet .\FrontEnd\bin\Debug\net5.0\FrontEnd.dllC:\demo\test\DaprBackEnddapr run --dapr-http-port 3501 --app-port 5001 --app-id frontend dotnet .\FrontEnd\bin\Debug\net5.0\FrontEnd.dll Starting Dapr with id frontend. HTTP Port: 3501. gRPC Port: 1045 time2021-09-23T14:15:24.522223608:00 levelinfo msgstarting Dapr Runtime -- version 1.4.0 -- commit ed969edc72b3934fffb481f079b736f3588e373a app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.526965908:00 levelinfo msglog level set to: info app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.526965908:00 levelinfo msgmetrics server started on :1046/ app_idfrontend instancechesterchen-lap scopedapr.metrics typelog ver1.4.0 time2021-09-23T14:15:24.530260308:00 levelinfo msgstandalone mode configured app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.530290408:00 levelinfo msgapp id: frontend app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.530290408:00 levelinfo msgmTLS is disabled. Skipping certificate request and tls validation app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.55912808:00 levelinfo msglocal service entry announced: frontend - 10.32.193.9:1051 app_idfrontend instancechesterchen-lap scopedapr.contrib typelog ver1.4.0 time2021-09-23T14:15:24.55912808:00 levelinfo msgInitialized name resolution to mdns app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.56010808:00 levelinfo msgloading components app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.564108908:00 levelinfo msgcomponent loaded. name: pubsub, type: pubsub.redis/v1 app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.564108908:00 levelinfo msgwaiting for all outstanding components to be processed app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.567108208:00 levelinfo msgcomponent loaded. name: statestore, type: state.redis/v1 app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.567108208:00 levelinfo msgall outstanding components processed app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.567108208:00 levelinfo msgenabled gRPC tracing middleware app_idfrontend instancechesterchen-lap scopedapr.runtime.grpc.api typelog ver1.4.0 time2021-09-23T14:15:24.567108208:00 levelinfo msgenabled gRPC metrics middleware app_idfrontend instancechesterchen-lap scopedapr.runtime.grpc.api typelog ver1.4.0 time2021-09-23T14:15:24.567108208:00 levelinfo msgAPI gRPC server is running on port 1045 app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.568403908:00 levelinfo msgenabled metrics http middleware app_idfrontend instancechesterchen-lap scopedapr.runtime.http typelog ver1.4.0 time2021-09-23T14:15:24.570049108:00 levelinfo msgenabled tracing http middleware app_idfrontend instancechesterchen-lap scopedapr.runtime.http typelog ver1.4.0 time2021-09-23T14:15:24.570049108:00 levelinfo msghttp server is running on port 3501 app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.570593108:00 levelinfo msgThe request body size parameter is: 4 app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.570593108:00 levelinfo msgenabled gRPC tracing middleware app_idfrontend instancechesterchen-lap scopedapr.runtime.grpc.internal typelog ver1.4.0 time2021-09-23T14:15:24.570593108:00 levelinfo msgenabled gRPC metrics middleware app_idfrontend instancechesterchen-lap scopedapr.runtime.grpc.internal typelog ver1.4.0 time2021-09-23T14:15:24.571129408:00 levelinfo msginternal gRPC server is running on port 1051 app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.571129408:00 levelinfo msgapplication protocol: http. waiting on port 5001. This will block until the app is listening on that port. app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0APP info: Microsoft.Hosting.Lifetime[0]APP Now listening on: http://[::]:5001APP info: Microsoft.Hosting.Lifetime[0]APP Application started. Press CtrlC to shut down.APP info: Microsoft.Hosting.Lifetime[0]APP Hosting environment: ProductionAPP info: Microsoft.Hosting.Lifetime[0]APP Content root path: C:\demo\test\DaprBackEnd time2021-09-23T14:15:24.872914308:00 levelinfo msgapplication discovered on port 5001 app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0APP info: Microsoft.AspNetCore.Hosting.Diagnostics[1]APP Request starting HTTP/1.1 GET http://127.0.0.1:5001/dapr/config application/json -APP info: Microsoft.AspNetCore.Hosting.Diagnostics[2]APP Request finished HTTP/1.1 GET http://127.0.0.1:5001/dapr/config application/json - - 404 0 - 19.0408ms time2021-09-23T14:15:24.918835408:00 levelinfo msgapplication configuration loaded app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.919369208:00 levelinfo msgactor runtime started. actor idle timeout: 1h0m0s. actor scan interval: 30s app_idfrontend instancechesterchen-lap scopedapr.runtime.actor typelog ver1.4.0APP info: Microsoft.AspNetCore.Hosting.Diagnostics[1]APP Request starting HTTP/1.1 GET http://127.0.0.1:5001/dapr/subscribe application/json -APP info: Microsoft.AspNetCore.Hosting.Diagnostics[2]APP Request finished HTTP/1.1 GET http://127.0.0.1:5001/dapr/subscribe application/json - - 404 0 - 0.2000ms time2021-09-23T14:15:24.923609308:00 levelinfo msgdapr initialized. Status: Running. Init Elapsed 393.349ms app_idfrontend instancechesterchen-lap scopedapr.runtime typelog ver1.4.0 time2021-09-23T14:15:24.939394808:00 levelinfo msgplacement tables updated, version: 0 app_idfrontend instancechesterchen-lap scopedapr.runtime.actor.internal.placement typelog ver1.4.0 Updating metadata for app command: dotnet .\FrontEnd\bin\Debug\net5.0\FrontEnd.dll Youre up and running! Both Dapr and your app logs will appear here.  Dapr CLI查看运行中的appdapr listAPP ID HTTP PORT GRPC PORT APP PORT COMMAND AGE CREATED PIDbackend 3511 1033 5000 dotnet .\BackEnd\... 9s 2021-09-24 09:25.17 860frontend 3501 1056 5001 dotnet .\FrontEnd... 7s 2021-09-24 09:25.19 5236测试调用1.浏览器地址栏输入http://localhost:3501/v1.0/invoke/frontend/method/daprhttp://localhost:3501/v1.0/invoke/frontend/method/dapr/get2http://localhost:3501/v1.0/invoke/frontend/method/DaprDI可以看到正常响应 2.DaprCLI测试调用打开cmd输入dapr invoke --app-id frontend --verb GET --method dapr也可以看到调用成功C:\Users\chesterychendapr invoke --app-id frontend --verb GET --method dapr result is OK [{date:2021-09-24T14:20:51.238668108:00,temperatureC:47,temperatureF:116,summary:Mild},{date:2021-09-25T14:20:51.238670508:00,temperatureC:50,temperatureF:121,summary:Mild},{date:2021-09-26T14:20:51.238670708:00,temperatureC:34,temperatureF:93,summary:Hot},{date:2021-09-27T14:20:51.238670808:00,temperatureC:42,temperatureF:107,summary:Bracing},{date:2021-09-28T14:20:51.238670908:00,temperatureC:-19,temperatureF:-2,summary:Warm}] App invoked successfullyPS:单机运行的情况下每个服务的sidecar是一个进程名为daprd下图两个分别是backend和frontend连个服务的 链路追踪自承载的方式下Dapr默认启动了zipkin容器可以通过以下链接查看http://localhost:9411/zipkin/
http://www.sadfv.cn/news/394567/

相关文章:

  • php企业网站例子仙踪林老狼网站欢迎您拍照
  • 教育类网站开发艺术生搭建wordpress个人博客
  • 网站备案添加域名沭阳那家做网站的
  • 创建一个网站买卖给网站做接口
  • 宝安做网站公司乐云seo郑州网络工程学院
  • 网站设计制作是什么做网站会很忙吗
  • 优质的菏泽网站建设html5做网站系统
  • 3免费做网站wordpress mysqladmin
  • 新手做啥网站好梅州网站优化公司
  • 网站开发中 登录不上了2345浏览器网页
  • 请人制作软件的网站微网站设计尺寸
  • 柳市网站优化网上怎么注册公司免费的
  • 网站综合查询工具图片下载网站
  • 为什么什么网站都在维护仿土巴兔网站建设
  • 重庆邮电大学官网网站茂名免费自助建站模板
  • 网站首页页面网页游戏百度
  • 漂亮的企业网站源码贵州黔东南双控体系建设网站
  • 哪些做营销型网站做的好做设计不能不知道的网站
  • 做同城服务网站比较成功的网站WordPress主题niRvana
  • 个人做外包网站多少钱连锁餐饮网站建设
  • 绍兴商城网站开发设计wordpress的文章分类
  • 多语言外贸网站设计东莞营销网站建设多少钱
  • 景点网站开发积极意义做毕设的网站万
  • 59一起做网站软件开发工作稳定吗
  • 做镜像网站湖南做旅游网站
  • 企业网站模板下载哪家口碑好广西网络干部学院官网
  • 网站建设logo网站免费模版
  • 高端网站建设设计公司排名中国建设银行网站官网下载安装
  • 网站备案 接入商名称vps绑定多个网站
  • 济南小型网站建设建设一个网站首先需要什么条件