Dev Tunnels: A Game Changer for Mobile Developers

    Dev Tunnels: A Game Changer for Mobile Developers

    Dev Tunnels: A Game Changer for Mobile Developers

    Posted: 06 Feb 2024

    Are you a mobile application developer who faces challenges when building a back end for your apps? If youíre using .NET, particularly ASP.NET Core, then youíve probably encountered the issue of debugging locally on your machine versus using emulators or physical devices. But fear not, because Visual Studio 2022 has introduced a great feature called Dev Tunnels that change your development process forever!

    The Problem: Localhost vs Emulators/Devices

    When youíre developing mobile applications, having a smooth debugging experience is crucial. However, things can get a little tricky when you need to test your app on emulators or physical devices. These devices have their own network stack and often canít directly communicate with your local machine. This becomes a roadblock when trying to access the local back end of your app running on localhost. While it is possible, it is quiet a bit of work to get setup and maintain as you work with several services.

    Enter Dev Tunnels

    Dev Tunnels is a game changer for mobile developers and even web developers. It provides a solution to the problem mentioned above by creating a unique URL that acts as a loopback to your local machine. This URL is accessible from the internet, allowing you to expose localhost to emulators, devices, or even share it with others. It has several authentication and access options based on what your requirements are.

    Setting Up Dev Tunnels in Visual Studio 2022

    Dev Tunnels was officially released with Visual Studio 2022 v17.6, so simply update to the latest version and you are ready to go. You can setup a new Dev Tunnel from the debug dropdown menu inside of Visual Studio to configure it for the active project.

    Upon opening the Dev Tunnels window, youíll see options to create tunnels. You can choose a name for the tunnel, specify its lifespan (persistent or temporary), and decide whether it should be private, organizational, or public. The public option allows the tunnel to be accessed by anyone on the internet with the URL.

    After creating a tunnel, run the backend and youíll be provided with a unique URL for your local back end. You can also open the Dev Tunnels window, to see all of your tunnels and change configurations.

    Now test out your API, call it from your mobile app, or debug it with a colleague. Set a breakpoint in your API and when the API is called it will get hit because the tunnel is talking to your local machine.

    How I Use Dev Tunnels with .NET MAUI

    Suppose you have an ASP.NET Core web API back end running on your local machine and a .NET MAUI application that needs to communicate with this back end. With Dev Tunnels, you can easily expose localhost to the internet and interact with your back end from emulators or devices.

    By running the ASP.NET Core back end and creating a Dev Tunnel, youíll be assigned a unique URL. You can then use this URL in your .NET MAUI application to connect to the back end. Whether youíre using an Android emulator, an iOS device, or any other platform, Dev Tunnels will allow you to seamlessly debug and access your back end.

    Other Use Cases for Dev Tunnels

    Dev Tunnels isnít limited to just mobile application development. It can also be utilized for debugging Azure functions, sharing local web projects with colleagues, build Teams apps, and much more. The flexibility and convenience it offers make it a valuable tool for developers working with various technologies.

    Beyond Visual Studio with the Dev Tunnels CLI

    No Visual Studio? No Problem? Dev Tunnels have a full CLI that can run everywhere enabling unique scenarios from your favorite code editors and more.


    Dev Tunnels in Visual Studio 2022 have revolutionized how I debug my applications and I think it will for you as well. By providing a unique URL that acts as a tunnel to your local machine, you can easily expose localhost and access your back end from emulators or devices. This feature brings convenience and efficiency to the development process, allowing for seamless testing and debugging.

    So, why not give Dev Tunnels a try? Get the latest version of Visual Studio 2022, create your own tunnels, and experience the benefits firsthand. Share your thoughts in the comments below and let us know how Dev Tunnels have enhanced your development workflow. Happy coding!

    Brink's Avatar Posted By: Brink
    06 Feb 2024

  1. Posts : 2,283
    Windows 10 Pro/Windows 7 Ultimate

    Looks like a reverse proxy. Being the pessimistic POS I Am... I wouldn't trust it...

    Must have borrowed the idea from ZeroTier and the likes... I don't even really trust them either. I'd build my own in Vultr or whatever.
      My Computer

  2. Posts : 706
    Windows 7

    What's the over & under on this hitting Black Hat 2025? Feeling lucky...
      My Computer

  3. Posts : 1,696
    Windows 10 Pro (+ Windows 10 Home VMs for testing)

    "While it is possible, it is quiet a bit of work"

    Such a basic error hardly inspires confidence in Microsoft's Quality Assurance processes if even proofreading is poor/non-existent.
      My Computer

  4. Posts : 2,283
    Windows 10 Pro/Windows 7 Ultimate

    garlin said:
    What's the over & under on this hitting Black Hat 2025? Feeling lucky...
    Thinking Shodan or Masscan will be the likely sources of results... LOL!
      My Computer

  5. Posts : 1,744
    Windows 10 Pro

    F22 Simpilot said:
    Thinking Shodan or Masscan will be the likely sources of results... LOL!
    +1. Black Hat is always fun. :)
      My Computers

  6. Posts : 1,092
    Windows 10

    yeah sounds suss what would happen if its possible for some dev to release an app with a backdoor in it? Exposing the local host through a webservice.

    Instant access to the target machine?

    idk because i don't make mobile apps. Sounds plausible though.
      My Computer


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:27.
Find Us

Windows 10 Forums