Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET 5 An error occurred while starting the application

Tags:

After publishing an ASP.NET Web App, I'm trying to host the website on my local server. However, when I start it up, it gives me this error in my browser:

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

How can I debug what this error is? The website works (both Debug and Release configurations) when starting using IISExpress and "web" in Visual Studio.

I am using the Development environment, and I have already specified app.UseDeveloperExceptionPage();.

I have followed the instructions here to deploy to IIS.

I've also tried the suggestion offered here (re-publishing with "Delete all existing files prior to publish" selected). (The OP there has a slightly different error, so that's why I'm posting a new question.)

I've looked for hours on the internet, but there doesn't seem to be much content about it. Any ideas?

I am on Windows 7, using ASP.NET 5 RC1.

like image 377
painiyff Avatar asked Feb 26 '16 23:02

painiyff


People also ask

How do I add dependency injection to startup CS?

The implementation class of above interface having dummy data. Then we have to create a Controller(API) for calling this repo, and inject this interface into this. In the last, we have to register it in Startup class. Also mention which type of instance want to inject - (the lifetime) of our instance.


2 Answers

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

like image 174
Muqeet Khan Avatar answered Oct 06 '22 13:10

Muqeet Khan


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.

like image 33
Andre Avatar answered Oct 06 '22 14:10

Andre