Exposing and testing your local web solutions online using NGrok

We’ve been using Web Hooks lately to try the new Microsoft ASP.NET Web Hooks implementation in action through Visual Studio.

The problem with testing and debugging such a solution is that it expects a URL to connect to, and while in production or on test location it’s not a problem, testing and debugging it on your local machine through Visual Studio in development it is a problem because we don’t have a public facing URL.

To be able to have a public facing URL, we need some kind of tunnel and a public address to our local machine.

For this we can use a great free tool NGrok.

What it does is, when you fire it up, it brings up a random URL to the local URL you point it to, and in a very simple way, opens your local machine to the public world.

In case you opt for a commercial version of the great product, you can have predefined subdomains instead of random ones.

We can use this for example to test Web Hooks receivers in a way that we register this public facing URL to one of the services online like GitHub, Instagram, Slack and others and then receive Web Hook calls directly to our machine.

To use this with Visual Studio, click F5 in your solution which will open your local application in the browser.

Download the NGrok tool which is a simple *.exe program.

Now if the URL of the application is for example: https://localhost:5007 then the command for NGrok in the command line would be:

c:\utils\ngrok\ngrok.exe http 50007 -host-header=”localhost:5007″

This opens up a window like this:

NGrok

And after this is opened, we and everyone else can access our application through e.g. 7410fb7b.ngrok.io

As long as this command line application is opened.

And that is it, hope it helps!

NET Media international services ltd. (NET Media međunarodne usluge d.o.o.) | OIB: 39220099203 | VAT ID: HR39220099203
Raiffeisenbank Austria d.d. Petrinjska 59, 10000 Zagreb | ŽR: 2484008-1106011288 | SWIFT: RZBHHR2X | IBAN: HR0224840081106011288
HQ: Starčevićeva 2 | Office: Kopilica 5 | 21000 Split | Republic of Croatia | T: +385 21 782 706 | F: +385 21 782 704
Registered at the Commercial Court of Split, under the No: Tt-11/5859-2 | MBS: 060277288 | Share capital 373.000,00 kn paid in whole | Board member: Mato Božić

NET Media international services ltd. (NET Media međunarodne usluge d.o.o.) | OIB: 39220099203 | VAT broj: HR39220099203
Raiffeisenbank Austria d.d. Petrinjska 59, 10000 Zagreb | ŽR: 2484008-1106011288 | SWIFT: RZBHHR2X | IBAN: HR0224840081106011288
Sjedište: Starčevićeva 2 | Ured: Kopilica 5 | 21000 Split | Republika Hrvatska | T: +385 21 782 706 | F: +385 21 782 704
Društvo je upisano u registar Trgovačkog suda u Splitu pod brojem: Tt-11/5859-2 | MBS: 060277288 | Temeljni kapital društva 373.000,00 kn uplaćen u cijelosti | Član uprave: Mato Božić

Contact us today!

You are here for a reason. Let’s talk.

Contact us