Practicing and exploring
Test your knowledge and understanding by answering some questions, get some hands-on practice, and explore this chapter's topics with deeper research.
Exercise 18.1 – Test your knowledge
Answer the following questions:
- Which base class should you inherit from to create a controller class for an ASP.NET Core Web API service?
- If you decorate your
Controller
class with the[ApiController]
attribute to get default behavior like automatic 400 responses for invalid models, what else must you do? - What must you do to specify which controller action method will be executed in response to an HTTP request?
- What must you do to specify what responses should be expected when calling an action method?
- List three methods that can be called to return responses with different status codes.
- List four ways that you can test a web service.
- Why should you not wrap you use of
HttpClient
in a using statement to dispose of it when you...