Ricky-5520 avatar image
0 Votes"
Ricky-5520 asked ·

.Net Core Web API on Azure is not providing API endpoints, only default starter page

I've built a simple "Web API" using .Net Core 3.1. Works great locally, and connects to an Azure SQL database. However, when I publish the API to an Azure App Service, I'm unable to figure out where the API is or why it isn't working. Publish is successful. Azure log stream seems to show that the container starts up successfully. However, I only get the default azure web app page, like it was when I first set up the App Service. I've tried checking port 8080, 8081, 5000, 5001, and even 55546/44311 used in IIS Express locally. There is nothing at those ports. When I go to https://[myapp][myendpoint] I just get a 404. I'm at a complete loss and have spent the entire day trying to figure out why this doesn't just work, considering how perfectly it works locally.

10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered ·

Apologies for the delay and any frustration with this issue.

Just to clarify, are you leveraging Azure App service Windows or Linux app?
Are you using the default parent base image base or different custom Docker image to run your ap?

Kindly ensure that the site deployment files are available D:\home\site\wwwroot\ directory. By default, the port 80 and 8080 is accessible (exposed ports).

Yes, you can simply navigate to http://<app_name> to see your deployed API.

Kindly use app setting WEBSITES_PORT to set the port for your own docker image while for blessed images use PORT environment variable as the listening port.

In your application, please use the PORT or WEBSITES_PORT (as applicable) environment variable as the main web server’s listening port, instead of using a hardcoded port number ( on app start-up on locahost:5000). The PORT environment variable is automatically set by App Service platform at startup time.

As mentioned, you could try these ways:

  • Use the EXPOSE instruction in your Dockerfile to expose port 5000.

  • Use the WEBSITES_PORT app setting with a value of "5000" to expose that port.

You can also always inspect the log files from the browser at https://<app-name> and leverage App Service diagnostics to fetch more details on the issue. To access App Service diagnostics, navigate to your App Service app in the Azure portal. In the left navigation, click on Diagnose and solve problems- From there, run the “Availability & Performance” & “Diagnostic Tools” for investigation.
If feasible restart the WebApp and then check to see if that helps.

Checkout this documentation ‘Tutorial: Host a RESTful API with CORS in Azure App Service’ for a detailed access steps.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If the issue still persists, I wish to engage with you offline for a closer look and provide a quick and specialized assistance, please send an email with subject line “Attn:Ajay” to AzCommunity[at]Microsoft[dot]com referencing this thread and the Azure subscription ID, I will follow-up with you.

Thanks for your patience and co-operation. Looking forward to your email

0 Votes 0 ·