Running a basic IIS web server

A virtual machine instance on Google Compute Engine can be controlled like any standard Windows server. Deploy a simple IIS web server to learn the basics of running a server on a virtual machine instance.

Prerequisites

You'll need a new Windows instance with HTTP traffic allowed.

  • Follow the Quickstart instructions to create a new Windows instance and connect to it with RDP.

Install IIS

  1. Right click the Windows PowerShell icon and select Run as Administrator to open the PowerShell terminal. Screenshot of the Windows PowerShell icon on the Windows Server desktop. The right click menu is open to select the Run as Administrator option.
  2. Install the IIS services with the following commands:
    import-module servermanager
    add-windowsfeature web-server -includeallsubfeature
  3. Overwrite the IIS web server default web page with the following command:
    echo '<!doctype html><html><body><h1>Hello World!</h1></body></html>' > C:\inetpub\wwwroot\index.html

Test your server

Test that your instance is serving traffic on its external IP.

  1. Go to the VM Instances page in the Google Cloud Platform Console.

    Go to the VM Instances page

  2. Click the external IP for your instance under the EXTERNAL IP column.

You should now see the "Hello World!" page.

Clean up

When you're done experimenting, follow the clean up instructions in the Quickstart to avoid incurring charges for this instance.

Troubleshooting

Receiving a Connection Refused error

If you are seeing a Connection Refused error, it is possible that your VM instance is not publicly accessible. This can be caused by two common errors: the VM instance does not have the proper tag that allows the instance to be externally accessible or your project does not have a firewall rule that allows external IP access.

To check that your instance has external access:

  1. Go to the VM Instances page in the Google Cloud Platform Console.

    Go to the VM Instances page

  2. Click the name of the instance that you are trying to connect to.
  3. Under Firewalls, make sure the Allow HTTP traffic box is checked. If it is not checked, check it.
  4. Save your changes.

Test your server again by going to the external IP address of the instance.

Send feedback about...

Compute Engine Documentation