ASP.NET 5 An error occurred while starting the application ASP.NET 5 An error occurred while starting the application asp.net asp.net

ASP.NET 5 An error occurred while starting the application


You should set the stdoutLogEnabled=true in the web.config file to see the actual error that is happening. You can direct where these files are written with the stdoutLogFile argument; the screenshot example below writes to stdoutLogFile=".\logs\stdout". (You should ensure the directory exists; the app won't create it)

As for not being able to find the proper config file yes the default environment is production. It is set to development explicitly in visual studio in the project properties.

Update: In AspNetCore RTM the module is called aspnetCore under the system.webServer node in web.config. Also, as @ErikE pointed out in comments, the web.config is now located in the root of the project and not under wwwroot as in previous releases.

enter image description here


This error also occurs when you are attempting a database connection from the startup (eg for seeding) and it fails on the deployment server due to insufficent previleges at the database server.


This error occurs under several conditions. In my situation, I did not have the database connection string set correctly. I fixed it in Visual Studio 2017 as follows:

1) Right-click project, select Publish, open the Publish page in main area.

2) Select the Publish tab on the left

3) Under Summary section, there's a "Settings..." link. Click it. This opens the Publish dialog.

4) Click Settings tab on the left.

5) Expand File Publish Options, check "Remove additional files at destination"

6) Expand Databases, check "Use this connection string at runtime" (This was pre-populated with my Azure SQL connection string based on how I originally set up my publish options)

7) Expand Entity Framework Migrations, check "Apply this migration on publish" (Again, connection string was pre-populated)

8) Click Save

9) Publish

10) Cross your fingers