Closed ToeToeAung closed 4 years ago
1.Consul Service Discovery
2.API
API is working well.
API call in postman : http://localhost:7000/api/getnerateconfigservice/GetClientID
{ "ReRoutes": [ { "DownstreamPathTemplate": "/api/{everything}", "DownstreamScheme": "http", "DownstreamPort": 7104, "ServiceName": "generateconfigservice", "UpstreamPathTemplate": "/api/{everything}", "UpstreamHttpMethod": [ "Get" ] } ], "GlobalConfiguration": { "ServiceDiscoveryProvider": { "Host": "consul", "Port": 8500, "Type": "Consul" } } }
Error encountered
What is ‘consul’ in the Host? Is that in you hostfile? If I’m running consul locally i’ll point to localhost or 127.0.0.1
On Sat, 24 Aug 2019 at 04:35, ToeToeAung notifications@github.com wrote:
1.Consul Service Discovery
[image: image] https://user-images.githubusercontent.com/5344377/63632097-f752bc80-c662-11e9-8d77-544700c7b036.png
2.API
API is working well.
[image: image] https://user-images.githubusercontent.com/5344377/63632102-02a5e800-c663-11e9-9746-433ad50ab263.png
- API Gateway
API call in postman : http://localhost:7000/api/getnerateconfigservice/GetClientID
{ "ReRoutes": [ { "DownstreamPathTemplate": "/api/{everything}", "DownstreamScheme": "http", "DownstreamPort": 7104, "ServiceName": "generateconfigservice", "UpstreamPathTemplate": "/api/{everything}", "UpstreamHttpMethod": [ "Get" ] } ], "GlobalConfiguration": { "ServiceDiscoveryProvider": { "Host": "consul", "Port": 8500, "Type": "Consul" } } }
Error encountered
[image: image] https://user-images.githubusercontent.com/5344377/63632109-12253100-c663-11e9-9c12-e28e20f93a17.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ThreeMammals/Ocelot/issues/995?email_source=notifications&email_token=ADDWTO42XI23JMVR5ZKKGRLQGCT7JA5CNFSM4IPAURQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5BXLQQ#issuecomment-524514754, or mute the thread https://github.com/notifications/unsubscribe-auth/ADDWTO4DVVP6SLSWOHAZKNTQGCT7JANCNFSM4IPAURQA .
Hi @djrhodes ,
I have tried with localhost & 127.0.0.1 as well, It is still getting error.
I am following the sample as
https://medium.com/@paulius.juozelskis/api-gateway-using-net-core-ocelot-and-consul-f0adea97f57
Hi @TomPallister,
Could you take a look this. Thanks in advance.
ocelot version is 13.5.2???
Yes. @winlj I tried test with 13.5.2 and 13.5.0.
13.5.1 ok
you try
Is it because of json file and client call? http://localhost:7000/generateconfigservice/apiname
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamPort": 7104,
"UseServiceDiscovery": true,
"LoadBalancerOptions": { "Type": "RoundRobin" },
"ServiceName": "generateconfigservice",
"UpstreamPathTemplate": "/api/generateconfigservice/{everything}",
"UpstreamHttpMethod": [ "Get" ],
"ReRoutesCaseSensitive": false
}
],
"GlobalConfiguration": {
"ServiceDiscoveryProvider": {
"Host": "localhost",
"Port": 8500,
"Type": "Consul",
"PollingInterval": 100
}
}
}
[HttpGet]
[Route("api/generateconfigservice/GetClientID")]
[Produces("application/json")]
public string GetClientID()
7000 port is the for the base Url
Yes. Now I am trying with 13.5.1 and still getting error.
o my god
Any issue?
Hi, sorry you’re still having issues with this. A couple of things don’t seem right. Firstly, the address in your service instance config in Consul is pointing to generateconfigservice:80 (but looks like you’re running the downstream service on localhost:7104)? Though it looks healthy in consul so wouldn’t expect an error. Can you post your consul config including the healthcheck endpoint?
Secondly, as you’re using service discovery you shouldn’t need to specify DownstreamPort in the re route config. Not sure if this causes a problem, but worth taking out anyway.
John Sent from my iPhone
On 26 Aug 2019, at 09:00, ToeToeAung notifications@github.com wrote:
Any issue?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Hi djrhodes,
How can we made a call service using service name?
On Mon, Aug 26, 2019 at 5:02 PM djrhodes notifications@github.com wrote:
Hi, sorry you’re still having issues with this. A couple of things don’t seem right. Firstly, the address in your service instance config in Consul is pointing to generateconfigservice:80 (but looks like you’re running the downstream service on localhost:7104)? Though it looks healthy in consul so wouldn’t expect an error. Can you post your consul config including the healthcheck endpoint?
Secondly, as you’re using service discovery you shouldn’t need to specify DownstreamPort in the re route config. Not sure if this causes a problem, but worth taking out anyway.
John Sent from my iPhone
On 26 Aug 2019, at 09:00, ToeToeAung notifications@github.com wrote:
Any issue?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ThreeMammals/Ocelot/issues/995?email_source=notifications&email_token=ABIYY6INMM6UU453Q4KJZ63QGOL2HA5CNFSM4IPAURQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5DYWII#issuecomment-524782369, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIYY6PA6DLOMLX5KBVB65LQGOL2HANCNFSM4IPAURQA .
http://localhost:7000/generateconfigservice/apiname. is it correct way to call?
Looking at your route config, assuming your gateway is on localhost:7000 it would be http://localhost:7000/api/generateconfigservice/getconfigid
On Tue, 27 Aug 2019 at 04:26, ToeToeAung notifications@github.com wrote:
http://localhost:7000/generateconfigservice/apiname. is it correct way to call?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/ThreeMammals/Ocelot/issues/995?email_source=notifications&email_token=ADDWTO4YOVTAT4V2K73FUM3QGSNH3A5CNFSM4IPAURQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5GLLQY#issuecomment-525120963, or mute the thread https://github.com/notifications/unsubscribe-auth/ADDWTOYJQZTPHJ2YIF5QZL3QGSNH3ANCNFSM4IPAURQA .
@ToeToeAung this error is because of new pull request(#909 ) for ssl failure which changing address to node name
Sorry for late reply. This issue has been solved.
I have fixed by using with correct service registry with specific port and call that service from ocelot api gateway.
hii can u please share the ocelotconfig.json file
I am also facing this issue.
I am getting error in ocelot and consul api gateway. Please take a look. Ocelot.Errors.Middleware.ExceptionHandlerMiddleware[0] requestId: 0HLP7RAM3DIPM:00000002, previousRequestId: no previous request id, message: Exception caught in global error handler, exception message: No such host is known, exception stack: at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask`1.get_Result()