When you create a class to be used as the model in a .NET MVC application, the class has to have a parameterless constructor. It is called during the POST when the user clicks the submit button of the form. If the class does not have a parameterless constructor, we will get the following generic error message. None of the breakpoints can help you to find the cause, and there is no entry in the event log.
The website cannot display the page
Most likely causes:
•The website is under maintenance.
•The website has a programming error.
What you can try:
Refresh the page.
Go back to the previous page.
When your MVC 5 web application page tries to read the database using the Entity Framework in a loop you may get the following error message:
Message=There is already an open DataReader associated with this Command which must be closed first.
This usually happens when a cshtml page receives an IEnumerable<> model from the database and makes repeated calls to retrieve the rows one-by-one in a foreach loop.
If your page does not display paged data, read the rows into a List with the ToList() method and send the list to the cshtml page to iterate through it. This forces the application to read all appropriate rows with one call from the database.
Sometimes you can also eliminate the problem if you add the following to the connection string in the web.config file: