Search code examples
.netasp.net-coreswaggerswagger-uiswagger-2.0

Swagger UI Not Loading


Swagger UI is not loading, Json is loading as expected but issue exists with supported js, css files.

you can see the issues in this images


Solution

  • Try to copy the /dist directory in vendor/swagger-api/swagger-ui inside your project. I'm not sure about the proper way, but I was facing the same issue and it worked for me. Also, try to provide more details of the issue you are facing, maybe code snippets too. Alternatively, try the following :

    1. Check if all your controller methods have [http] tag. If they all do and still doesn't work go to step 2
    2. In your configure function to ensure that you have app.UseStaticFiles(); If it still doesn't work go to step 3
    3. Uninstall and reinstall swagger. If it doesn't work go to step 4 (Core Only)
    4. If you are using Core Install Microsoft.AspNetCore.StaticFiles and reference it in your project.