GithubHelp home page GithubHelp logo

Comments (17)

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024 1

Yes, that was the issue. Thanks a lot for your help. It works like a charm now!

from mmlib.swaggerforocelot.

Burgyn avatar Burgyn commented on June 16, 2024

Hi @ljubomir-bacovic,

please provide more information. Some logs from your gateway, logs from browsers, ...

Thanks.

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

The log from gateway:

RequestPath: /swagger/docs/v1/scheduling

An unhandled exception has occurred while executing the request.

Exception:
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at MMLib.SwaggerForOcelot.Repositories.DownstreamSwaggerDocsRepository.GetSwaggerJsonAsync(RouteOptions route, SwaggerEndPointOptions endPoint, String docsVersion)
at MMLib.SwaggerForOcelot.Middleware.SwaggerForOcelotMiddleware.Invoke(HttpContext context, ISwaggerEndPointProvider swaggerEndPointRepository, IDownstreamSwaggerDocsRepository downstreamSwaggerDocs)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

Browser just shows 500 error fetching API definition.

image

from mmlib.swaggerforocelot.

Burgyn avatar Burgyn commented on June 16, 2024

This is still very general. Please provide your gateway configuration and try to explain how you host in IIS.

If you use Virtual directories look here: https://github.com/Burgyn/MMLib.SwaggerForOcelot#virtual-directory

Thank you.

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

I don't use virtual directory. At this point, I host two sites, Gateway, which is publicly accessible through https, and one microservice that is accessed by gateway via http at the port 5001.

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

My gateway configuration:

{
"Routes": [
{
"UpstreamPathTemplate": "/api/scheduling/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"SwaggerKey": "scheduling",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5001
}
]
}
]
}

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

Swagger endpoints:

{
"SwaggerEndPoints": [
{
"Key": "scheduling",
"Config": [
{
"Name": "MyCorp.Services.Scheduling.API",
"Version": "v1",
"Url": "http://localhost:5001/swagger/v1/swagger.json"
}
]
}
]
}

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

@Burgyn any idea?

from mmlib.swaggerforocelot.

Burgyn avatar Burgyn commented on June 16, 2024

At the moment, I can't think of anything you might have a problem with. It normally works on IIS. Please check all addresses and ports to see if they match. Also check the logs in the browser (network tab) to see what kind of query the SwaggerUI is sending internally, if there has been any change in the base address.

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

This is my Network tab

image

from mmlib.swaggerforocelot.

Burgyn avatar Burgyn commented on June 16, 2024

Hey @ljubomir-bacovic .

I really want to help you, but without relevant information and your proper investigation it will not work.

Check all logs and configurations properly (ocelot.json and Startup.cs).
Check if you can get the swagger.json for the downstream service directly through the browser http://localhost:5001/swagger/v1/swagger.json
...

Friendly advice. If you are asking for help somewhere then really try to give as much information which can help. Also try to format things sensibly. If something is code (even JSON) then format it as code until you can read things. Thank you very much. See markdown docs

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

@Burgyn

I tried to explain as much as I could. Also, I spent two full days investigating this issue and trying to understand it. There is not much information online, since locally everything works perfectly when I start from Visual Studio. Also, the gateway and the API work on the server as well, we use them to develop frontend. But we would like to have Swagger deployed, so that the frontend team can understand the API better.

from mmlib.swaggerforocelot.

Burgyn avatar Burgyn commented on June 16, 2024

From this url http://localhost:5001/swagger/v1/swagger.json you get correct swagger.json? If so, try looking at the logs from the gateway to see what address it was trying to forward it to.

I can't help more. So far I haven't had a problem with IIS.

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

No, when I try this on the server, I get 404 error.

from mmlib.swaggerforocelot.

ljubomir-bacovic avatar ljubomir-bacovic commented on June 16, 2024

So that means that the issue is that Swagger is not working on API level. I will try to investigate that.

from mmlib.swaggerforocelot.

Burgyn avatar Burgyn commented on June 16, 2024

That's good to hear.

from mmlib.swaggerforocelot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.