Another gotcha with API projects is that their UI (often their Swagger UI) may only be available during development, but not once they are deployed to live.
To check for this have a look in Startup.cs for any code that is run conditionally based on anenv.IsDevelopment() check. For example, the .NET Core Web API template adds this code:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebApplication6 v1"));
}
If you put that project's API URL in the browser on a development machine you'll see the Swagger API as expected. However, if you do the same with the deployed version of that app you'll get a 404 as env.IsDevelopment is no longer true.
There are some other scenarios that can cause a 404 in this thread too.