Virtual Directory configuration IIS doesn't work UpstreamPathTemplate 404 not found
Opened this issue · 1 comments
IgnacioCastro0713 commented
I'm trying to configure my Gateway and two microservices but they don't work when they are in virtual directories each.
all these are on the same server
folder structure of IIS:
├── DataWarehouseService
├── AgileService
└── Gateway
└── Ocelot
└── ocelot.json
this is my ocelot.json
{
"GlobalConfiguration": {
"BaseUrl": "https://domain.com/Gateway"
},
"Routes": [
{
"DownstreamPathTemplate": "/agile/api/v1/{everything}",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7122
}
],
"UpstreamPathTemplate": "/agile/v1/{everything}",
"UpstreamHttpMethod": ["GET", "POST", "PUT", "DELETE"],
"SwaggerKey": "agile"
},
{
"DownstreamPathTemplate": "/DataWarehouse/api/v1/{everything}",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7082
}
],
"UpstreamPathTemplate": "/DataWarehouse/v1/{everything}",
"UpstreamHttpMethod": ["GET", "POST", "PUT", "DELETE"],
"SwaggerKey": "DataWarehouse",
"VirtualDirectory": "/DataWarehouseService"
}
],
"SwaggerEndPoints": [
{
"Key": "agile",
"TakeServersFromDownstreamService": true,
"Config": [
{
"Name": "PLXS.Microservice.Agile",
"Version": "v1",
"Url": "https://domain.com/AgileService/swagger/v1/swagger.json"
}
]
},
{
"Key": "DataWarehouse",
"TakeServersFromDownstreamService": true,
"Config": [
{
"Name": "DataWarehouse EndPoints",
"Version": "v1",
"Url": "https://domain.com/DataWarehouseService/swagger/v1/swagger.json"
}
]
}
]
}
code configuration:
app.UsePathBase("/Gateway");
app.UseSwaggerForOcelotUI(options =>
{
if (app.Environment.IsDevelopment()) return;
//IIS Config
options.PathToSwaggerGenerator = "/swagger/docs";
options.DownstreamSwaggerEndPointBasePath = "/Gateway/swagger/docs";
options.ServerOcelot = "/Gateway";
});
IgnacioCastro0713 commented
My configuration works perfectly locally but there I’m not using virtual paths just run the 3 projects as usual