Using Forward with IIS

Out of the box, IIS is only setup to listen for requests coming from localhost. Because of this, IIS will return a "bad request" error when trying to view a project through Forward. Fortunately, this can easily be fixed by adding an additional binding in IIS for your Forward URL.

Creating a new binding

The first thing you’ll need to do is open up your applicationhost.config and search for either the name or the port of the project you want to forward. Next, look for the project’s <bindings> section. You should see something like:


<bindings>
  <binding protocol="http" bindingInformation="*:1234:localhost" />
</bindings>
  

With 1234 being the port that your project is setup to use.

Once you’ve located the correct bindings, you’ll need to copy the <binding protocol> line and paste it below the existing one, replacing localhost with your Forward URL:

<binding protocol="http" bindingInformation="*:1234:yourforwardurl.fwd.wf" />

So your <bindings> section in all should look something like:


<bindings>
  <binding protocol="http" bindingInformation="*:1234:localhost" />
  <binding protocol="http" bindingInformation="*:1234:yourforwardurl.fwd.wf" />
</bindings>
  

After you’ve added the additional binding, save and close your applicationhost.config. There’s just one more step before you can start forwarding your IIS project.

Reserving a URL for IIS

By default Windows doesn’t allow regular users to reserve or use any URL other than localhost. This means that when you load up IIS, it will complain that your user doesn’t have access to the additional binding you did for your Forward URL in applicationhost.config.

To get around this, you have two options:

  1. You can run IIS as an administrator. Since the admin has access to use all URLs, IIS will load up fine with the new binding.

  2. The other option is to reserve that URL for everyone with the add urlacl command. To do this, open up a command prompt as an admin and run:

    netsh http add urlacl url=http://yourforwardurl.fwd.wf:1234/ user=everyone

    replacing yourforwardurl.fwd.wf with your actual Forward URL and 1234 with the port number of your IIS project.

    If you do choose to use this command, you’ll only need to run it again if you start a new project with a different port, or you change the port you're using for your project.

Now that everything is setup, you can open your IIS site in Chrome, click the Forward button, and start sharing it with colleagues, clients, or friends and family.