Internal Server Error While Running a Simple .Net Core MVC Application on Ubuntu 16.04

Internal Server Error while running a simple .Net Core MVC application on Ubuntu 16.04

Under the buildOptions node in project.json, add an entry called "preserveCompilationContext": true and this should fix the above error.

Find the exact Internal Server Error in containerised ASP.Net application

The typical troubleshooting steps are,

  1. Identify the substatus code from IIS log files. As you showed in the question body, IIS log entry said 500.19.
  2. 500.19 indicates invalid IIS configuration (applicationHost.config and web.config), so have to review your configuration and see what's wrong.
  3. The presence of <rewrite></rewrite> requires URL Rewrite module to be installed, which isn't met in the default Docker base images.

That explains why you saw the 500 error and concludes the investigation.

You didn't see this error in VS, because IIS Express there has this module by default.

While many other developers in the situation will need to use the MSI package to install URL Rewrite module in their containers, you simply need to delete the unused tag.

Reference on such 500.19 errors

https://docs.jexusmanager.com/tutorials/oob-500.html

asp.net core app deployed on iis meets 500 internal server error

  1. Change stdoutLogEnabled="false" to true and then check the logs at stdoutLogFile=".\logs\stdout". The error(s) there might tell you something.

  2. Check that you set up right Environment Name using ASPNETCORE_ENVIRONMENT environment variable as so use correct settings like connection string. On your machine by default you have "Development" environment.

  3. You may use Error Handling middlewares for showing exceptions like

    app.UseDeveloperExceptionPage();

ASP.NET Core hosting - 500 internal server error

I have also enabled stdoutLog in web.config as but I don't see that folder either:

stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"

There is one trick here - you must create both folders logs and stdout manually - then and only then IIS will create log file inside logs folder (not stdout as you could expect) - don't ask me why, because I don't know why ;)



Oops. 500 Internal Server Error An error occurred while starting the application.

Usually, means problems with a configuration in Startup.cs - the most common problems include an issue with DB itself, an issue with migrations (if you are using Code First approach), problems with appsettings.js, problems with Social Logins credentials (like missing SecretKey)...

Please refer to log file in .\logs\stdout - this is the quickest way to find details about the problem :)



app.UseDeveloperExceptionPage();

app.UseDatabaseErrorPage();

Those will work after your WebApp fully started, but not while starting the application.

What this error is complaining about while running test on RepositoryController Asp.Net Core?

It complaints because it doesn't know how to create an object of IUnitOfWork which is a dependency on your controller.

So to resolve the issue you need to instruct the framework on what implementation of IUnitOfWork you want to use. Typically you are doing it in your Startup.ConfigureServices method. For exmaple:

public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IUnitOfWork, UnitOfWorkImplementation>();
}
}

Where UnitOfWorkImplementation is a class that implement IUnitOfWork

.NET Core published app displays only 500 error

You see nothing in console because your publish/logging configurations is wrong.

You have appsettings.json file, but you don't publish it (publishOptions in projects.json). You publish appsettings.productions.json which does not exist.

As result, you have no any Logging section in your configuration. This [may be] the reason you see nothing in console.



Related Topics



Leave a reply



Submit