Create an ASP.NET Core web service
Debug your Service
-
Open the Controllers/ValuesController.cs class by double-clicking it the Solution pad on the left-hand side of the screen.
-
This ASP.NET Core project uses the MVC architecture, which follows a standard convention. By default, an API controller like ValuesController will handle all web requests to www.mydomain.com/api/Values and route them to the method matching the rest of the path.
-
Locate the Get method. This method will handle requests to www.mydomain.com/api/Values/Get. The project is configured by default to process this request, so the /Get may be omitted. Note that there are also methods for Get and Post (both with parameters).
-
Click the editor margin to the left of the return new string[]… line of code in Get to set a breakpoint. A breakpoint is used to stop execution of the app at that point and debug your app.
-
Click the Start Debugging button (with a Play icon) on the top left to build and start debugging the app. Alternatively, you can also start debugging by selecting the Run -> Start Debugging menu item.
-
When the application hits the line of code with the breakpoint, it stops executing and you will have access to a full array of debugging tools, including the call stack, variable inspectors, and more.
-
Click the Continue Running (the new Play icon in the group of 4) button to continue executing the code.
-
The API response will appear in your browser as JSON.
I ran into an issue I have run my service