404 when I deploy an ASP.NET Core Web API


When I deployed an ASP.NET Core Web API to my Azure App Service API App I received a 404 Not Found when the page was opened, as seen in Figure 1.

image

Figure 1, 404 ASP.NET Core

The reason for this is that the deployment or default ASP.NET Core Web API template does not include a default document in the root directory of the web site.  For example, index.htm, defualt.aspx, default.htm are default documents and IIS will deliver them if there is no specific file provided when accessing the URL.

You can place one of those files into the root directory of the web site, in the wwwroot directory or request the ASP.NET Core Web API directly by appending /api/<methodname> or by default add api/values to the end of your ASP.NET Core Web API and you should then get a JSON or XML response as expected.

Comments (0)

Skip to main content