could be your swagger is disabled on production release.
Net 6 API - 404 Not found
I have developed my API with .NET 6 and locally, I can see all controllers working and using them through swagger.
However when I publish to IIS, I am getting 404 not found.
I also have install Net 6.0.1. Windows Server Hosting, Net Runtime 6.0.1 x64, Net Runtime 6.0.1 x86, ASP.NET Core 6.0.1 Shared Framework.
What could be the problem ?
10 answers
Sort by: Most helpful
-
-
Antonio Santos 1 Reputation point
2022-04-08T15:20:19.537+00:00 In program.cs remove this line
if (app.Environment.IsDevelopment())
-
Gabriel Andrade de Sant Anna 1 Reputation point
2022-07-12T07:39:57.467+00:00 Has anyone solved this problem?
I'm going through the same situation
-
Bruce (SqlWork.com) 66,706 Reputation points
2022-07-12T16:54:34.13+00:00 which problem?
swagger not enabled in prod -> remove if wrapper
core module not installed -> install
deployed as sub site -> use correct url: https://server/site/swaggerif you want swagger UI to be the default page:
app.UseSwagger(); app.UseSwaggerUI(o => { o.SwaggerEndpoint("/swagger/v1/swagger.json", "v1"); o.RoutePrefix = string.Empty; });
-
elerasoft 1 Reputation point
2022-09-27T22:18:49.097+00:00 I am using Asp.net Core 6 and Angular. I lost 2 days solving this issue. I don't know why but when I use files in publish folder I faced this error. Using the published files in bin/release/net6.0 solved my problem.