Search code examples
.net-coreswaggerazure-service-fabricswagger-2.0swashbuckle

Fetch error FABRIC_E_TIMEOUT for SwaggerUI/swagger.json


I am developing an Azure Service Fabric Service, in which I have used Swashbuckle.AspNetCore to build API List. I am using the following code in my Startup.cs file

In ConfigureServices(IServiceCollection services)

services.AddSwaggerGen(c =>
                 {
                      c.SwaggerDoc("Backend", new Info { Title = "My Backend", Version = "v1.0" });
                 });`

And in Configure(IApplicationBuilder app, IHostingEnvironment env)

` app.UseSwagger(c => c.PreSerializeFilters
     .Add((swagger, httpReq) => swagger.Host = httpReq.Host.Value));

  app.UseSwaggerUI(c => c.SwaggerEndpoint("/MyApp.Fabric/MyApp.Backend/swagger/Backend/swagger.json",
        "Backend"));`

Here, because I am developing SF service, I have used reverse proxy with swagger endpoint configuration. Now the same thing is working with my other services except one. I have the same code and same version of Swashbuckle.AspNetCore nuget used in all of my services that is 3.0.0

When I try to access the SwaggerUI for this service, I am getting the following error

enter image description here

Can anyone please help me on this ? I have been trying but could not get any suitable solution..


Solution

  • On my case, when I dig the problem in more depth, I found in my APIs, there are some objects used which don't have any namespaces assigned. And somehow the runtime could not resolve the definitions for those objects which leads to a failure to load API definitions.

    @Tom Sun, if you could post your comment as an answer, I will be able to mark it as answer. Thank you.