Making ASP.NET apps first-class citizens on Google Cloud Platform

Datetime:2016-08-22 22:06:07          Topic: ASP.NET           Share
Posted by Chris Sells, Product Manager, Google Cloud Developer Tools

Google Cloud Platform is known for many things: big data, machine learning and the global infrastructure that powers Google. What you might not know is how well we support applications built on ASP.NET, the open-source web application framework developed by Microsoft. Let’s change that right now.

Windows Server on Google Compute Engine

To run ASP.NET 4.x, you need a Windows Server running IIS and ASP.NET. To do that, we support creating new Google Compute Engine VMs from both Windows Server Data Center 2008R2 and 2012R2 base images.

(click to enlarge)

Once you have your Windows Server image of choice, which should only take minutes to create and boot, you can establish user credentials, open up the appropriate ports with firewall rules, use RDP to connect to the machine and install whatever software you’d like.

If that software is comprised of the Microsoft IIS web server and ASP.NET, along with the appropriate firewall rules, you should definitely consider using  the ASP.NET image in the Cloud Launcher .

(click to enlarge)

Not only does it create a Windows Server instance for you, but it installs SQL Server 2008 Express, IIS, ASP.NET 4.5.2 and opens the standard firewall ports to enable HTTP, HTTPs, WebDeploy and RDP.

SQL Server images on Compute Engine

The SQL Server Express that comes out of the box with the ASP.NET image in Cloud Launcher is useful for development, but when it comes to production workloads, you’re going to want production versions of SQL Server. For that, we’re happy to announce the following versions of SQL Server on Google Compute Engine :

  • SQL Server Standard (2012, 2014, 2016)
  • SQL Server Web (2012, 2014, 2016)
  • SQL Server Enterprise coming soon (2012, 2014, 2016)

As of this week, these editions of SQL Server are available on Google Compute Engine as base images alongside Windows Server. This is the first time we’ve offered production editions of SQL Server, so we’re excited to hear your feedback ! Stay tuned next week for an in-depth post about SQL Server on Google Cloud Platform.

Google service libraries in NuGet

With Windows Server, ASP.NET and SQL Server, you’ve got everything you need to bring your ASP.NET 4.x sites and services to Google Cloud Platform, and we think you’re going to be happy that you did.

Further, we’ve heard from our customers how much they love the services provided across more than 100 Google APIs , all of which are available for a variety of languages and platforms, including .NET, in NuGet . Further, we’ve been working hard to ensure that our cloud-specific APIs are easy for .NET developers to understand. To that end, we’re pleased to announce that the vast majority of our Cloud API client library reference documentation has per-language examples, including for .NET.

To further improve usability of these libraries, we’ve created wrapper libraries for each of the Cloud APIs that are specific to each language. These libraries are in beta today, and include wrappers for Google BigQuery , Google Cloud Storage , Google Cloud Pub/Sub and Google Cloud Datastore , with more on the way. Google StackDriver Logging now also supports the log4net library, providing simplified logging for your apps, with all the goodness of StackDriver’s multi-machine, multi-app filtering and querying. These libraries are available in NuGet, as well as on GitHub , where you can log a bug, make a feature request or contribute back to the code!

These .NET library efforts are being led by none other than Jon Skeet, widely known for his C# books and for helping .NET developers on Stack Overflow . We’re very happy to have him helping us make sure that Google’s Cloud APIs are are good as they can be for .NET developers.

Cloud Tools for Visual Studio

One of the major reasons that we’ve made all of our libraries available via NuGet is so that you can bring them into your projects easily from inside Visual Studio. However, we know that you want to do more with your cloud projects than just write code  you also want to manage resources like VMs and storage buckets, and you want to deploy. That’s where Google Cloud Tools for Visual Studio comes in, available as of today in the Visual Studio Gallery .

It’s also possible to deploy the ASP.NET 4.x app to Google Compute Engine via Visual Studio’s built-in Publish dialog, but with the Cloud Tools extension, we’ve also made it easy to administer the credentials associated with your VMs and to generate their publish settings files from within Visual Studio.

This functionality is available inside the Google Cloud Explorer, which allows you to browse and manage your Compute Engine, Cloud Storage and Google Cloud SQL resources.

This is just the beginning. We’ve got lots of plans for integrating Cloud Platform deeper into Visual Studio. If you’ve got suggestions, bug reports or if you’d like to help, Cloud Tools for Visual Studio is hosted on GitHub . We’d love to hear from you!

Cloud Tools for PowerShell

Visual Studio is a great way to interactively manage your cloud project resources, but it’s not great for automation. That’s why we’re announcing Google’s first PowerShell extensions, Cloud Tools for PowerShell . With our Google Cloud PowerShell cmdlets, you can manage your Compute Engine and Cloud Storage resources.

(click to enlarge)

We started with cmdlets for the two most popular Cloud Platform products, Compute Engine and Cloud Storage, but we're quickly expanding support to cover other products as well. If you’ve got suggestions about what we should do next, bug reports for what we’ve already got or if you’d like to help, the Google Cloud PowerShell cmdlets are being developed on GitHub .

Migrating existing VMs

Compute Engine’s support for Windows Server and SQL Server, along with our integration with Visual Studio and PowerShell, help you bring your .NET apps and SQL Server data to the Google Cloud Platform. But what if you need more? What if you’d rather not set up new machines, configure them and migrate your apps and data? Sometimes, you just want to bring an entire machine over as it is in your data center and run it on the cloud as if nothing had changed.

A new partnership with CloudEndure does just that.

CloudEndure replicates Windows and Linux machines at the block level, so that all of your apps, data and configuration comes along with your migration. To learn more about migration options for Windows workloads, or for help planning and executing a migration, check out these Google Cloud Platform migration resources .

Coming soon: support for ASP.NET Core

Many developers are exploring ASP.NET Core for their next-generation workloads. Because ASP.NET Core is fully supported on Linux, you can wrap it in a Docker container and deploy it via App Engine Flexible or Kubernetes running on Google Container Engine . ASP.NET is not fully supported on either of these platforms yet, but to give you a taste of where we’re headed, we’ve enabled all of the Google API Client Libraries to work on .NET Core (with the exception of our hand-crafted libraries  we’re still working on those). For example, here’s some ASP.NET Core code that pulls a random JPEG image from a Google Cloud Storage bucket:

public IActionResult Index() {
  var service = new StorageService(new BaseClientService.Initializer() {
    HttpClientInitializer =
      GoogleCredential.GetApplicationDefaultAsync().Result
  });

  // find all of the public JPGs in the project buckets
  var request = service.Objects.List("YOUR-GCS-BUCKET");
  request.Projection = ObjectsResource.ListRequest.ProjectionEnum.Full;
  var items = request.Execute().Items;
  var jpgs = items.Where(o => o.Name.EndsWith(".jpg") &&
                         o.Acl.Any(o2 => o2.Entity == "allUsers"));

  // pick a random jpg to show
  ViewData["jpg"] =
    jpgs.ElementAt((new Random()).Next(0, jpgs.Count())).MediaLink;
  return View();
}

We’re working to enable first-class support for containers-based deployment as well as Linux-based ASP.NET Core. Until then, check out this sample code for running simple .NET apps on Cloud Platform.

We’re just getting started

First and foremost, we’re serious about supporting Windows and .NET workloads on Google Cloud Platform. Second, we’re just getting started. We have big plans across all areas of Windows/.NET support and we’d love your feedback  whether it’s to report a bug, make a suggestion or contribute some code!

We’ll leave you with one more resource: .NET on Google Cloud Platform lists everything a developer needs to know to be successful with .NET on Cloud Platform. If there’s something you need that you can’t find, drop a note to the Google Cloud Developers group

!





About List