Giter Club home page Giter Club logo

multiweb's Introduction

multiweb

Multiple projects for debugging sample.

Opening VS Code

Launch VS Code with the project root as the current working directory. One easy way to do this is to type the word "code" followed by a dot "." at a Command Prompt, Powershell window or Windows Terminal.

Powershell/Terminal Command:

code .

Powershell Command

If you already have VS Code open, use the built-in Terminal (Ctrl+`) to change the current directory to the project root.

In either case, you should end up with VS Code open with the Terminal open in the correction location (project root).

VS Code with Terminal panel

Launch Configuration

This project contains launch.json configuration for a .NET Core console project and a Web API projet.

Web API Launch Configuration: Web API Launch Config

Console Project Launch Configuration: Console Project  Launch Config

Debug Panel

In the Debug Panel of VS Code, observe that you can see both configurations, ready for launch.

Web API in Debug Panel: Web API in Debug Panel

Console Project in Debug Panel: Console Project in Debug Panel

Setting Breakpoints

In the code for each project, set a breakpoint that's easy to identify.

e.g. Inside Get() method within WeatherForecastController.cs in Web API project Breakpoint in Web API project

e.g. Console.WriteLine in Console project Breakpoint in Console project

Debugging with Breakpoints

From the aforementioned Debug Panel, run the Web API project and then the Console project by clicking the Play/Debug button for each launch configuration.

Note: when the web browser launches at the root of the website, you may browse to the WeatherForecast Controller manually, e.g. https://localhost:5001/WeatherForecast

You should see each program pause at the breakpoints you set earlier.

e.g. Breakpoint in Web API project: Breakpoint in Web API project

e.g. Breakpoint in Console project: Breakpoint in Console project

Continue Running

Press the Play/Continue button to continue running while debugging. Observe the output in a web browser (for the Web API project) or the Terminal within VS Code (for the Web API project)

e.g. Output in Web API project: Output in Web API project

e.g. Output in Console project: Output in Console project

Optional: Run Multiple Projects

As a bonus, I have added a Compounds section to the launch.json file.

    "compounds": [
        {
            "name": "Both Console & Web API",
            "configurations": [
                ".NET Core Launch (console)",
                ".NET Core Launch (web)"
            ]
        }

This will allow you to launch both the Console app (in the Terminal) and the Web API app (in a browser) in rapid succession, with 1 click.

e.g. Debugging multiple projects: Debugging multiple projects

multiweb's People

Contributors

shahedc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.