ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.32k stars 1.63k forks source link

Can't use Ocelot in IIS #1263

Closed dack94 closed 5 months ago

dack94 commented 4 years ago

Hi :)

i'm using Ocelot with a microservices arch. there are 2 ApiS :

image

this is my Ocelot config file

/configuration gateway/ { "ReRoutes": [ { "DownstreamPathTemplate": "/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 44301 } ], "UpstreamPathTemplate": "/authentication-api/{everything}", "SwaggerKey": "authentication-api" }, { "DownstreamPathTemplate": "/{everything}", "DownstreamScheme": "https", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 44302 } ], "UpstreamPathTemplate": "/student-api/{everything}", "SwaggerKey": "student-api" } ], "SwaggerEndPoints": [ { "Key": "authentication-api", "Config": [ { "Name": "Authentication API", "Version": "v1", "Url": "https://localhost:44301/swagger/v1/swagger.json" } ] }, { "Key": "student-api", "Config": [ { "Name": "Students API", "Version": "v1", "Url": "https://localhost:44302/swagger/v1/swagger.json" } ] } ], "GlobalConfiguration": { "BaseUrl": "https://localhost:44300" } }

When i publish the gateway application (api that contains the ocelot config file) it generates also the .exe for studentApi but not for AuthenticationApi. at this point i've two questions :

  1. Is it normal that if i publish the gatewayApi it generates in same folder the .exe for studentApi also ?

  2. How it should works ? should i publish all 3 apiS in 3 different folders and after expose only the gateway api?


So after that (i've tried to use this folder with the .exe of studentApi generated) i've created a pool and a website in IIS (on port 80, i've changed the default to 90). if i open http://localhost:80/swagger it works (i retrieve some errors with iis on swagger don't know if is due to the fact that it can't find studentApi and AuthenticationApi). when i try to call http://localhost:80/student-api/stages it doesn't work and print an error 500.

i've examinate the iis logs and apparently there is nothing strange.

If there is something string or you don't understand something let me know and i'll try to better explain.

Thanks.

I'm using : .net core 3.1 ocelot v 13.8.0

raman-m commented 5 months ago

Oh, my gosh! 😄

You were real student! Good luck in learning ASP.NET framework!