Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual Directory configuration IIS doesn't work UpstreamPathTemplate 404 not found #269

Open
IgnacioCastro0713 opened this issue Jun 15, 2023 · 1 comment
Assignees

Comments

@IgnacioCastro0713
Copy link

IgnacioCastro0713 commented Jun 15, 2023

Screenshot_2
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 IgnacioCastro0713 changed the title Virtual Directory configuration IIS does not work Virtual Directory configuration IIS doesn't work UpstreamPathTemplate 404 not found Jun 16, 2023
@IgnacioCastro0713
Copy link
Author

My configuration works perfectly locally but there I’m not using virtual paths just run the 3 projects as usual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants