Base solution for your next web application
Open Closed

Swagger UI: Not Found /swagger/v1/swagger.json #5531


User avatar
0
alexanderpilhar created

I'm having troubles with swagger ui after publishing Web.Host-project to on-premise IIS. It's just a test-deployment and is therefor located in a subfolder (accessible via <a class="postlink" href="https://mydomain.local/project-name/">https://mydomain.local/project-name/</a>).

swagger ui shows following error message:

Failed to load API definition. Errors Fetch error Not Found /swagger/v1/swagger.json

I guess this is because the project is located in a subfolder!?

If so, please, tell me how to make this work!

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

8 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    I assumed that your subfolder refer to sub-site.

    If so, it is resolved by <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/1476">https://github.com/aspnetzero/aspnet-ze ... ssues/1476</a>.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alexanderpilhar created

    Thank you for your reply!

    Your information did help me solve the problem after all!

    Although it was not the only bit that had to be edited to make it all work. There also is the file Web.Host\wwwroot\swagger\ui\index.html that has to be edited - it references two files using absolute paths:

    <script src="/project-name/swagger/ui/abp.js"></script>
        <script src="/project-name/swagger/ui/abp.swagger.js"></script>
    

    Maybe, this information should/could be included to the ticket you linked!?

    Anyway, thank you very much for your help!

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    maliming created
    Support Team

    already fixed.

    <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/commit/b20c367744296a10b89c4c255094b600c8bdded5#diff-d6079b3a17e1fb63a7b9442a0bf90a81">https://github.com/aspnetzero/aspnet-ze ... 2a0bf90a81</a>

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alexanderpilhar created

    Great :) that's way better!

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alexanderpilhar created

    I was happy too soon - the API itself is still not working … there must be even more places left to be edited.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ryancyq created
    Support Team

    Does swagger API UI load correctly for you now?

    What are the errors for the APIs?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alexanderpilhar created

    Yes, swagger ui looks good so far!

    But authorization doesn't work. At first, I thought it wasn't a big problem - the URI was lacking the 'project-name', so I edited Web.Host\wwwroot\swagger\ui\abp.swagger.js. But there is still something else going wrong as I now receive HTTP 500 when trying to authenticate.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    alexanderpilhar created

    Okay, there was an issue with the connection to the DB - it's working now 8-)

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)