4
votes

I am able to perform a web deploy to an Azure App Service successfully, but then the web application can't be found.

I deployed an ASP.NET Core 2.2 web application that works fine locally. On the portal, nothing is showing a problem. When I call it via e.g.,

https://xxxxxxxxx.azurewebsites.net/api/values 

I get the error:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. (404)

2
How do you publish to Azure? Do you use a web.config file,refer to stackoverflow.com/questions/51558155/… - Ryan

2 Answers

0
votes

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.

Hope it helps.

0
votes

It turns out that Visual Studio 2019 does not create a web.config file. That does not bother our on-premise IIS servers. But the Azure App Service needs one—but does provide not provide a specific error if it doesn’t have one.

I got the hint from they read, “.NET Core Web API not working after being deployed to Azure”.

None of the walkthroughs or tutorials I have seen mention it.