Getting started with .NET on Compute Engine Stay organized with collections Save and categorize content based on your preferences.
This tutorial shows how to get started with Compute Engine.Follow this tutorial by deploying a Hello World .NET webapp to Compute Engine. For help getting started with App Engine, seetheApp Engine standard environment.
Objectives
- Deploy a Hello World sample app to a single Compute Engine instance.
Costs
In this document, you use the following billable components of Google Cloud:
To generate a cost estimate based on your projected usage, use thepricing calculator.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Make sure that billing is enabled for your Google Cloud project.
Enable the Compute Engine API.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Make sure that billing is enabled for your Google Cloud project.
Enable the Compute Engine API.
- Install.NET Core SDK 2.1 or later on your local machine runningMicrosoft Windows.
- InstallWeb Deploy 3.6 or later on your local machine runningMicrosoft Windows.
Running the app locally
Download and unzip or clone the sample repository from github:
git clone https://github.com/GoogleCloudPlatform/getting-started-dotnet.git
In a PowerShell window, go into the
HelloWorld
directory:cd getting-started-dotnet\HelloWorld
Start a local web server:
dotnet run
Open a web browser to
localhost:8080
.In your web browser, you see some Hello World text, served from yourlocal machine.
When you're ready to move on, stop the local web server by pressingControl+C.
Deploying to a single instance
This section walks you through running a single instance of your appon Compute Engine.
Create and configure a Compute Engine instance
From Google Cloud Marketplace, you can launch an instance of Windows running Microsoft IIS on Compute Engine.
In the Google Cloud console, go to theASP.NET Framework Cloud Marketplace page.
ClickLaunch.
Leave the settings set to their default values, and clickDeploy.
Wait for the Compute Engine instance to deploy. It usuallytakes about 5 minutes to deploy.
To display resource information, clickVM instance.
To edit the VM instance, clickManage Resource.
ClickSet Windows password, and then make a note of the username.
Copy the new Windows password, and then clickClose.
In theVM instance details page, make a note of the external IP address.
On your local Windows machine, edit the file
HelloWorld/Properties/PublishProfiles/ComputeEngine.pubxml
.Enter your VM instance's external IP address between
<MSDeployServiceURL>
and</MSDeployServiceURL>
. For example,<MSDeployServiceURL>203.0.113.22</MSDeployServiceURL>
Enter the instance's username that you previously noted between
<UserName>
and</UserName>
.Save your changes to the
ComputeEngine.pubxml
file.In a PowerShell window, publish your app to the Compute Engine instance:
dotnet publish -c Release ` /p:PublishProfile=Properties\PublishProfiles\ComputeEngine.pubxml ` "/p:Password=YOUR-PASSWORD"
Replace
YOUR-PASSWORD
with the password you previously copied.Open a web browser to your instance's external IP address.
In your web browser, you see some Hello World text, served from yourCompute Engine instance.
Manage and monitor an instance
You can use the Google Cloud console to monitor and manage your instance.
To view all of the logs generated by your Compute Engine resources, go to theLogs Explorer page.
Go to Logs ExplorerCloud Logging is automatically configured to gather logs from various common services, including
syslog
.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, either delete the project that contains the resources, or keep the project and delete the individual resources.
Delete the project
Delete the individual resources
gcloudcomputeinstancesdeletemy-app-instance--zone=YOUR_ZONE--delete-disks=allgcloudcomputefirewall-rulesdeletedefault-allow-http-80
What's next
Explore reference architectures, diagrams, and best practices about Google Cloud.Take a look at ourCloud Architecture Center.
For other .NET resources for building your apps, see the following:
- Manage and monitor your Instance Group deployment atCompute Engine > Instance groups.
- Manage your load balancing configuration, including URL maps and backendservices, atNetwork services > Load balancing.
- Deploy an app to Google Kubernetes Engine
- Explore otherGoogle Cloud services.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-09 UTC.