DAPR客户端Docker撰写问题

Dapr Client Docker Compose Issue(DAPR客户端Docker撰写问题)
本文介绍了DAPR客户端Docker撰写问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将3个服务与本地Docker实例中的DAPR集成。每个服务都在Linux容器中运行。

version: '3.4'
networks:
  NextWare:
    external: true
services:
  nextware.daprtest.service1.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - DAPR_GRPC_PORT=40001
    ports:
      - "40001:40001" # Dapr instances communicate over gRPC so we need to expose the gRPC port
      - "4001:80"
    depends_on:
      - redis
      - placement
    networks:
      - NextWare
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro

  nextware.daprtest.service1.api-dapr:
    image: "daprio/daprd:edge"
    command: [
      "./daprd",
     "-app-id", "nextware.daprtest.service1.api",
     "-app-port", "3001",
     "-dapr-grpc-port", "40001",
     "-metrics-port", "9091",
     "-placement-host-address", "placement:50006", # Dapr's placement service can be reach via the docker DNS entry
     "-components-path", "/components"]

    volumes:
        - "./components/nextware.daprtest.service1.api:/components" # Mount our components folder for the runtime to use
    depends_on:
      - nextware.daprtest.service1.api
    network_mode: "service:nextware.daprtest.service1.api" # Attach the nodeapp-dapr service to the nodeapp network namespace

  nextware.daprtest.service2.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - DAPR_GRPC_PORT=40003
    ports:
      - "40003:40003" # Dapr instances communicate over gRPC so we need to expose the gRPC port
      - "4003:80"
    depends_on:
      - redis
      - placement
    networks:
      - NextWare
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro

  nextware.daprtest.service2.api-dapr:
    image: "daprio/daprd:edge"
    command: [
      "./daprd",
     "-app-id", "nextware.daprtest.service2.api",
     "-app-port", "3003",
     "-dapr-grpc-port", "40003",
     "-metrics-port", "9093",
     "-placement-host-address", "placement:50006" # Dapr's placement service can be reach via the docker DNS entry
     ]
    volumes:
        - "./components/nextware.daprtest.service2.api:/components" # Mount our components folder for the runtime to use
    depends_on:
      - nextware.daprtest.service2.api
    network_mode: "service:nextware.daprtest.service2.api" # Attach the nodeapp-dapr service to the nodeapp network namespace


  nextware.daprtest.service3.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - DAPR_GRPC_PORT=40005
    ports:
      - "40005:40005" # Dapr instances communicate over gRPC so we need to expose the gRPC port
      - "4005:80"
    depends_on:
      - redis
      - placement
     
    networks:
      - NextWare
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro


  nextware.daprtest.service3.api-dapr:
    image: "daprio/daprd:edge"
    command: [
      "./daprd",
     "-app-id", "nextware.daprtest.service3.api",
     "-app-port", "3005",
     "-dapr-grpc-port", "40005",
     "-metrics-port", "9095",
     "-placement-host-address", "placement:50006" # Dapr's placement service can be reach via the docker DNS entry
     ]
    volumes:
        - "./components/nextware.daprtest.service3.api:/components" # Mount our components folder for the runtime to use
    depends_on:
      - nextware.daprtest.service3.api
    network_mode: "service:nextware.daprtest.service3.api" # Attach the nodeapp-dapr service to the nodeapp network namespace

运行Docker PS时,我看到以下容器..

在服务启动并运行后,我尝试从Service3调用以下代码到Service1.

 var request = _mapper.Map<UpdateRequest>(integrationCommand);
 await _daprClient.InvokeMethodAsync("nextware.daprtest.service1.api", "Update", request, cancellationToken);

我收到以下异常.

RequestUri是否正确.

";http://127.0.0.1:3500/v1.0/invoke/nextware.daprtest.service1.api/method/Update";

鉴于这是调用SideCar的DaprClient,我假设上面的RequestUri是正确的。

我错过了什么?

推荐答案

错误的原因是ID和方法名称格式不正确。

我从Docker Compose转到Tye,遇到了同样的问题。

然后我根据此屏幕截图更改了调用。

虽然此操作仍未调用Update方法,但它不再返回500异常。

相反,我得到了以下异常,我也很难解决这个问题.

根据验证过程,远程证书无效:RemoteCertificateNameMismatch,RemoteCertificateChainErrors

这是由于以下启动配置设置,我将其注释掉,之后一切正常.

DAPR岩石!

这篇关于DAPR客户端Docker撰写问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)