因此,我有一个控制台应用程序,需要调用后端运行在码头上。我使用ocelot作为api网关和api。
当我在postman中对我的网关进行测试调用时,请求传入,ocelot试图重定向到api,但我得到了一个ENOTFOUND。
我使用的是坞-合成名称,我也尝试使用容器名称。
ocelot配置:
{
"Routes": [
{
"DownstreamPathTemplate": "/api/fileagent",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "fileagentapi",
"Port": 80
}
],
"UpstreamPathTemplate": "/fileagent",
"UpstreamHttpMethod": [ "POST"]
}
],
"GlobalConfiguration": {
"RequestIdKey": "ocRequestId"
}
}80港是国内码头集装箱港口。
docker-撰写配置:
version: '3.4'
services:
fileagentapi:
image: ${DOCKER_REGISTRY-}fileagentapi
container_name: FileAgentApi
build:
context: .
dockerfile: Services/FileAgentApi/Dockerfile
gateways:
image: ${DOCKER_REGISTRY-}gateways
build:
context: .
dockerfile: Api-Gateways/Gateways/Dockerfile
ports:
- 50000:443
- 50001:80发布于 2022-12-01 19:55:12
很长一段时间后,我发现了我的问题。
在我的程序文件->中,仍然启用了app.UseHttpsRedirect()。在http进行测试时,这将无法工作。
https://stackoverflow.com/questions/74593462
复制相似问题