\n","author":{"@type":"Person","name":"Reeves62"},"upvoteCount":8,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"
\n\nweb page was found for the web address: https://securedmessaging.azurewebsites.net/ HTTP ERROR 404
\n
You mentioned that the app is a ASP.NET Core Web API app that does not include and serve a default page, so that it would cause a 404 Not Found error while you access the site without a fully qualified URI.
\nTo make request to API endpoint, you can try:
\nhttps://securedmessaging.azurewebsites.net/WeatherForecast \n
\nOr
\nhttps://securedmessaging.azurewebsites.net/api/brokers/{action_name_here}\n
\nBesides, if you'd like to serve a default page that's displayed at the root URL for a website, you can try:
\n1) Create Default.html
under wwwroot folder
2)Call the UseDefaultFiles
method in Configure
method of Startup.cs
app.UseDefaultFiles();\n\napp.UseStaticFiles();\n\napp.UseRouting();\n
\nTest Result
\n\n","author":{"@type":"Person","name":"Fei Han"},"upvoteCount":6}}}Reputation: 149
I am trying to create a web api that connects to my Azure SQL database and reads from the data, I used the 'API' template from VS19 and adding my own files, I ran the app locally (the templates weather forecast worked fine) and I tested my API using postman. I then deployed my api directly from VS to my app service in Azure but when I go to the URL I get the following error:
This securedmessaging.azurewebsites.net page can’t be foundNo web page was found for the web address: https://****.azurewebsites.net/ HTTP ERROR 404
Can someone please help me run the app from azure as it runs locally? Im not sure where I went wrong. Below is a picture of my solution explorer.
Upvotes: 8
Views: 10504
Reputation: 93
In my case following lines were missing from Startup.cs
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
}
);
Adding these lines in the configuration section of the startup.cs fixed the issue.
Upvotes: 0
Reputation: 27825
web page was found for the web address: https://securedmessaging.azurewebsites.net/ HTTP ERROR 404
You mentioned that the app is a ASP.NET Core Web API app that does not include and serve a default page, so that it would cause a 404 Not Found error while you access the site without a fully qualified URI.
To make request to API endpoint, you can try:
https://securedmessaging.azurewebsites.net/WeatherForecast
Or
https://securedmessaging.azurewebsites.net/api/brokers/{action_name_here}
Besides, if you'd like to serve a default page that's displayed at the root URL for a website, you can try:
1) Create Default.html
under wwwroot folder
2)Call the UseDefaultFiles
method in Configure
method of Startup.cs
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseRouting();
Test Result
Upvotes: 6