SSH remote port forwarding with Serveo for IIS Express

A while ago I attended an OfferZen Make Day and learnt about SSH tunneling which creates a secure connection between a local computer and a remote machine through which services can be relayed.

Tools like ngrok & Serveo expose local servers to the internet, essentially you can get a public url for your local web server. A use case for this would be testing WebHooks.

At the time, I couldn't get it working and I became a great joke to the *nix guys.
Trying it out recently, I got it to work with IIS Express with little effort.
I'm using Serveo because you don't need to install anything, provided you're on Windows 10.

URL Binding IIS Express

If you don't want to run Visual Studio with administrative privileges.
You'll need to configure HTTP.sys to allow these bindings for a standard user.

In an elevated command prompt, run the following commands.
Remember to replace the http and https port numbers with the ones actually used by your web app.

netsh http add urlacl url=http://*:56246/ user=Everyone
netsh http add urlacl url=https://*:44304/ user=Everyone

Modify your applicationhost.config file

In your ASP.NET web project folder, you'll find applicationhost.config at the following path,

Find the url bindings, it will look something like

<binding protocol="http" bindingInformation="*:56246:localhost" />
<binding protocol="https" bindingInformation="*:44304:localhost" />

You'll need to remove * and localhost, this allows the web app to work with forwarding and locally.

<binding protocol="http" bindingInformation=":56246:" />
<binding protocol="https" bindingInformation=":44304:" />
Start exposing!

ssh -R 80:localhost:56246
ssh -R 44300:localhost:44304
For https, you can't use port 443. Use any other port so Serveo can forward the TCP connections.
You might get a certificate mismatch warning in your browser, just ignore it.