This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.
However, sometimes the preview server fails to start. This means you may preview your game and see "service unavailable", or it simply times out. If this happens to you, try following these steps.
It's possible the browser made a request before the server was ready. Wait a moment and hit refresh (F5), and the game might appear.
If you have more than one instance of Construct 2 running, they may be conflicting. Try closing all Construct 2 windows, opening just one, then preview again.
Some badly-written browser extensions or addons break Construct 2 games. This is the fault of the extension or addon and does not mean there's a bug in Construct 2. Disabling any third party browser extensions or addons can sometimes fix problems.
It might be just one browser having a problem. Try switching to another browser and see if it works. For example, if you're previewing on Internet Explorer, switch to Firefox or Chrome and try again. The Preview Browser project property can help with this.
Most computers have a firewall that block certain kinds of connections. Check your firewall allows activity on port 50000. There are many kinds of firewall out there, but the tutorial on how to preview on a local network includes steps to set up Windows Firewall.
In the Preferences dialog you can change the port the preview server runs on. Try changing it to something else in the range 10000-65500 and try previewing again.
Other server software, like Microsoft IIS server or multiplayer game servers, could conflict with Construct 2's preview server. Try shutting down or disabling any other software on your computer that could be acting as a server.
Under normal conditions, the preview server should work on a non-admin account or when not elevated with admin permissions. However, some systems have different permission setups, and running as an administrator may get around this.
Previewing with the Preview-on-LAN feature works slightly differently and may allow you to preview successfully. Try following the steps in how to preview on a local network.
Construct 2 previews a URL like http://localhost:50000. localhost must be set to the local address (127.0.0.1), which it is by default. On rare occasions a computer can be configured so localhost goes somewhere else, and this breaks Construct 2's preview.
Editing the HOSTS file is an advanced topic - you may wish to discuss this with your network administrator if you do not have permission or are uncomfortable making the change.
On Windows 7, the HOSTS file can be found at: %systemroot%\system32\drivers\etc\
Add the following entries to ensure localhost directs to the local computer:
::1 localhost #[IPv6]
Networking is an advanced subject and there may be other network or internet settings on your computer that are causing problems for Construct 2. If you know how it may be worth double checking your computer's network and internet settings. Alternatively if you have someone who runs your network for you, try asking them for help.
If you find something else which fixes the problem for you, please let us know in the comments so we can add it to this guide!
I just would like to add that sometimes if you install a custom firewall on your network like pfsense or something else, you could lost the iis agent to listen from localhost.
For correct it just add this simple command on an elevated prompt :
netsh http add iplisten ipaddress=0.0.0.0
Thanks Ashley for the tutorial.