- Decide on a subdomain to use with ngrok. This makes the whole process easier.
- Open up a Command Prompt in Administrator mode and run the following command to register the URL with HTTP.sys replacing "modernie" with your subdomain and ##### with your VisualStudio/IISExpress application's port.
netsh add urlacl url=http://modernie.ngrok.com:##### user=everyone
- Edit your applicationhost.config. The easiest way to is start up the site and right-click the IISExpress icon in the System Tray. Click "Show All Applications" and select your website running at
localhost:#####
. Click the path next to "Config" to open the file in an editor. - Search for you site's
<bindings>
configuration. The easiest way is to search for*:#####:localhost
, which should bring you to the<bindings>
section for your site. Edit them to include the following:
<bindings>
<binding protocol="http" bindingInformation="*:#####:modernie.ngrok.com" />
<binding protocol="http" bindingInformation="*:#####:localhost" />
</bindings>
Save the file, making sure to replace "modernie" with your subdomain and ##### with your application's VisualStudio/IISExpress port.
- Restart your site.
- Run ngrok with the subdomain settings from a Command Prompt running in Administrator mode. This can be done with the following command:
ngrok.exe -authtoken XXXXXXXXXXXXXXXXXXXX -subdomain=modernie #####
Make sure to replace "modernie" with your subdomain and ##### with your application's VisualStudio/IISExpress port.
I'm trying to get this to work with a site name that's not "localhost", but using port 80. My binding info line is:
whatever.local.com is correctly added to the etc/hosts file and it the local site is viewable at whatever.local.com. I've tried running ngrok like so:
But when I go to the url ngrok provides, I get a 404 error (and the tunnel clearly works). When I add the following to applicationHosts.config file:
and restart the server, there is no change; I still get the 404.
I have also added the url with netsh as above. No dice.
I have no idea how to proceed, as I'm not sure where the issue lies. Clearly something is being served, it's just not the right something. If anyone has any insight, I would be very grateful. Ngrok is so blissfully easy to use on Mac/*nix, but IIS just makes me want to huck my machine out my 5th story window.