Closed juancash closed 7 years ago
@jsantanainel Please look at https://github.com/TomPallister/Ocelot/wiki/Startup for the startup class. Ocelot doesnt use services.AddOcelotFileConfiguration(Configuration); anymore.
Im curious where did you find the documentation for that as it must be out of date.
you might want to change your Program.cs to be the same as in the Startup example as well!
Also sometimes documentation is wrong by mistake so this is a good guide...
https://github.com/TomPallister/Ocelot/blob/develop/test/Ocelot.ManualTest/Startup.cs https://github.com/TomPallister/Ocelot/blob/develop/test/Ocelot.ManualTest/Program.cs
@TomPallister Yes I´m following that wiki. But in the version 1.3.2 of Ocelot (that is the last in Nuget) is not available an AddOcelot method with parameters.
@jsantanainel I a mistake and have not updated the readme before I made the release. I might do a new release now to correct the mistake.
@TomPallister No problem. Thanks.
@jsantanainel To answer question 4. Yes the performance is effected by by the number of entries in configuration.json. This is something that I would like to improve.
At the moment the code goes for each reroute, does that re route match the upstream Http request path, if it does then use it. The match is done using a regex that is built from the reroute entry in configuration.json at runtime based on what has been entered in UpstreamTemplatePath e.g. /products/{productId}/ becomes /products/.*/ so if you request /products/1/ it will match.
Obvious problem is looping through each entry to find a match as the more you look through the more you are matching which will effect performance.
I have taken a lean approach to building Ocelot doing the least I can to get a feature working with the idea we will come back and optimise later. The code has been written with performance in mind so it should not be too slow.
If you would like to investigate this and improve the code that would be awesome!
@TomPallister Perfect, we keep in touch.
I´m following the documentation to build an api gateway with Ocelot. I created a simple solution with two API, the APIGateway and the API1 (both with the Visual Studio Api template) with the target to try to redirect the requests. I have some questions:
services.AddOcelot(Configuration);
in ConfigureServices method from Startup class. This method AddOcelot is not available. I´m using:
is this correct?
var host = builder.Build();
System.InvalidOperationException: 'A public method named 'ConfigureDevelopment' or 'Configure' could not be found in the 'OcelotTest.Startup' type.'
If I use the code by default, seems run OK.
It´s possible use this code or will affect in something in the future?
Now I will try to use it with my IdentityServer, although I have to investigate a bit since I am very new to these two tools.
Thanks for your time.