0

I published my .NET Core project and uploaded it to my host (Plesk) but some parts aren't working properly. I can fix the problem if I know what it is but the server responds nothing but 404 - not found when it faces an error back there

P.S: The website is working fine generally, just a few sections aren't

Mohammad
  • 194
  • 5
  • 14
  • 404 is a specific error. It probably means the route/path is wrong. Include code for one of the pages (including link?) that is not working. – pcalkins Aug 06 '21 at 19:06
  • @pcalkins all routes are correct. It even responded 404 for a DB connection string problem...I know the error here is a problem with file uploading but I can't find out what it is. – Mohammad Aug 06 '21 at 19:17
  • include code of page(s)/controllers that produce the issue. (It'll help people to reproduce the problem and suggest solutions.) – pcalkins Aug 06 '21 at 19:28
  • If you suspect it's on the error-reporting side of things, include your "Startup.cs" file. For instance, mine has this in Configure method: " if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } – pcalkins Aug 06 '21 at 19:34
  • if you want to turn on Development mode on your live site, you can also add this to your "Program.cs" file... right in public static void Main(string[] args) method: Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development"); (Remember to comment out after you are done... it's best not to show full error messages on live site...) – pcalkins Aug 06 '21 at 19:44
  • 1
    @pcalkins you're last comment is exactly what I was looking for...thanks :) – Mohammad Aug 06 '21 at 19:53
  • @pcalkins if you don't mind, send it as solution so I can accept it – Mohammad Aug 06 '21 at 19:57
  • probably better not to, as some people will vote it down. It's not the "recommended" way to do this... it just happens to be the only way that worked for me. ( I think you're supposed to do this in config files instead. But that never worked in my case. ) Maybe someone will post the more correct answer. – pcalkins Aug 06 '21 at 20:01
  • See this post: https://stackoverflow.com/questions/41546943/how-to-set-aspnetcore-environment-to-be-considered-for-publishing-an-asp-net-cor – pcalkins Aug 06 '21 at 20:24

0 Answers0