0

I have recently published my first app to an internal web server using IIS. The web application opens fine and I can view the Home and About pages just fine. However, when I click on the Children page (which contains a list from a database table), I get this error:

enter image description here

I do have the ASPNETCORE_ENVIRONMENT set to Production under the Solution properties, so I'm not quite sure why it is saying "Development Mode". Is there somewhere else that I need to change a setting?

I did try: Swapping to the Development environment displays detailed information about the error that occurred. I still received the same exact error!

Any assistance would be greatly appreciated. Please phrase your answer so that an extreme novice can understand it. In other words, don't just say change X w/o explaining where X is and what to change X to. Thanks!!

EDITED TO ADD: Here is a snip from program.cs

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    // app.UseExceptionHandler("/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.//
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.MapRazorPages();

app.Run();
MelB
  • 141
  • 1
  • 12
  • Try commenting out `app.UseExceptionHandler("/Error");` in Program.cs (or Startup.cs if you are targeting dotnet 5 or earlier) and see if you can get the proper error message. – Mike Brind Dec 07 '22 at 16:56
  • That is part of an if, so I wan't sure whether to comment the entire if out or just that portion, so what I did is above in my post (just the line itself). When I publish it this way and click on the Children page, I get a 'The page isn't working HTTP 500 Error'. – MelB Dec 07 '22 at 18:45
  • Change the _web.config_ so that `stdoutLogEnabled="true"`, then run the app and check the log file that should get created in the logs folder in the root of the web site. – Mike Brind Dec 08 '22 at 07:20
  • Try using FRT to view details about the 500 error, which will generate a detailed log file to help you identify the problem. https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis – YurongDai Dec 13 '22 at 09:55

0 Answers0