No webpage was found for the web address

John chimbani 0 Reputation points
2024-02-05T10:14:14.5266667+00:00

I have deployed web api to Azure. The API has an SQL server which i have configured when deploying. I have checked the connection string is in the app settings and i have migrated my database with data so it should be working, but i keep getting a 404 upon deployment even though the deployment is successful. When i check the logs, there are no internal server errors, so i assume there is nothing wrong with the code. I have added my IP add to the server to allow connections. I dont really know what else i can do. Please help. I have spent a week on this. LogsUser's image

Result User's image

Output window User's image

Program.cs

using System.Text;
using bokningsapp.Data; 
using bokningsapp.Entities; 
using bokningsapp.Services; 
using Microsoft.AspNetCore.Authentication.JwtBearer; 
using Microsoft.AspNetCore.Identity; 
using Microsoft.EntityFrameworkCore; 
using Microsoft.IdentityModel.Tokens; 
using Microsoft.OpenApi.Models;  

var builder = WebApplication.CreateBuilder(args);  

// DbContext builder.Services.AddDbContext
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
297 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,880 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JasonPan - MSFT 4,281 Reputation points Microsoft Vendor
    2024-02-05T10:54:33.3+00:00

    Hi @John chimbani,

    Since you are getting 404 error, it means the web application is running well. You can test it with any of the GET request APIs.

    And the source code you shared has format issue, I'm not sure if you used 'app.Environment.IsDevelopment()'.

    Using the code below will display the Swagger UI.

    var app = builder.Build(); 
    app.UseSwagger(); 
    app.UseSwaggerUI(); 
    app.UseCors("AllowReactDevClient");
    ...
    

    Best Regards Jason

    0 comments No comments