First, add ASP.net MVC nuget package to the project.
Then change the Startup.cs class like below.
When you run the application, the browser must open following page, which means your IIS works correctly.
In ASP.net 5, there are two primary concepts.
- Middleware
- Services
Change the Startup class like below. Above mentioned middleware and Service codes are applied from Startup class. This code has configured to use DbContext using DI pattern.
If you have data in your database, then you will be able to see an output like below.
Assume, there was an exception occurred. Change the web api controller code like below.
Change the Startup.cs file content.
When you run the project, you will see a beautiful error handling page which contains lots of details.
Assume, there was an exception occurred. Change the web api controller code like below.
Change the Startup.cs file content.
When you run the project, you will see a beautiful error handling page which contains lots of details.
No comments:
Post a Comment