Hi Marjan,
If the API endpoints are working but you're unable to access the Swagger page, it indicates that the issue is specifically related to the Swagger UI configuration or deployment.
Here are a few steps to troubleshoot the problem:
- Verify Swagger configuration: Ensure that the Swagger configuration in your ASP.NET Core application is set up correctly. Check the configuration code in your startup file (
Startup.cs
) to confirm that the Swagger services and middleware are properly registered.
- Check the Swagger endpoint: By default, Swagger UI is usually available at the
/swagger/index.html
endpoint. However, this can be customized during configuration. Double-check the endpoint path for Swagger UI in your application.
Verify Azure Web App deployment: Make sure that the Swagger UI-related files, such as the Swagger JSON and the Swagger UI assets, are being deployed to Azure Web App correctly. Check your deployment process and ensure that these files are included.
Ensure correct Swagger endpoint URL: When accessing the Swagger UI page, verify that you're using the correct URL. It should be in the format: https://your-app.azurewebsites.net/swagger/index.html
(replace your-app
with your actual Azure Web App name).
Check for errors in the browser console: Open the browser's developer tools and check the console for any error messages. It's possible that there may be JavaScript errors preventing the Swagger UI from loading properly.
Test locally with Azure App Service emulator: To isolate any deployment-related issues, you can try running your application locally using the Azure App Service emulator. This allows you to test the deployment and Swagger UI functionality locally before deploying to Azure.
Enable detailed logging: In your Azure Web App's "Configuration" section, under "General settings," set "Detailed error messages" to "On." This can help identify any potential errors or issues related to serving the Swagger UI files.
Check the Azure Web App logs: In the Azure portal, navigate to your Web App and go to the "Log stream" or "Logs" section. Monitor the logs while accessing the Swagger UI to see if there are any error messages or exceptions related to serving the Swagger UI files.
By following these steps, you should be able to identify the cause of the issue and troubleshoot the problem with accessing the Swagger UI.
I hope this helps?