We on the .NET team for Cloud Foundry are pretty excited about our recently released support for .NET applications in CF! As of November 2015, this 1.0 support for Windows applications is available with Pivotal Cloud Foundry (PCF) 1.6, and is completely open source and available within the Cloud Foundry Foundation.
Finally, Windows developers will have access to the magic of Cloud Foundry!
We’re really excited to bring the magic of Cloud Foundry to Windows developers as well!
Cloud Foundry is a great platform for deploying your web applications. Once you’ve set it up, the experience as a developer is as easy as
cf push to push your app live to the platform.
In order to get .NET applications to run on a Windows Server, we needed to implement:
Garden container support for Windows*
*PS. This is where we got the name of the project. Garden + Windows = Greenhouse!
Over the past several months, we’ve spent a lot of time implementing both of these on top of Windows 2012 R2, and we now fully support Diego on Windows! You can see all of our code on Github in Diego Windows and Garden Windows.
Now that we’re all set with the background, lets actually deploy an app!
With that out of the way, now lets get to deploying. We’ll start with a simple sample app that you can just push. You can follow these instructions on either a Linux or a Windows client machine.
First clone our basic sample app to a new directory:
$ git clone https://github.com/cloudfoundry-incubator/NET-sample-app.git
You can also download the source from the GitHub page
If Diego is enabled by default on your CF deployment, you can just push your app and wait for it to start:
$ cf push my-app -s windows2012R2 -b binary_buildpack -p ./my-app/ViewEnvironment/
This is telling CF to push your app with the name
my-app, using the stack
windows2012R2, with the buildpack
binary_buildpack from the path of
If it’s not, or if you’re not sure, you’ll need to install the Diego Enabler CLI plugin and then enable Diego onn the application before starting it:
$ cf add-plugin-repo CF-Community http://plugins.cloudfoundry.org/ $ cf install-plugin Diego-Enabler -r CF-Community $ cf push my-app -s windows2012R2 -b binary_buildpack -p --no-start ./my-app/ViewEnvironment/ $ cf enable-diego my-app $ cf start my-app
Once your app is pushed, you can navigate to the app’s URL and you will see all the VCAP variables. Add
?all= to the URL to see all the system variables too.
For Windows applications, we rely on the binary_buildpack to push pre-compiled applications. If you want to push your own app, make sure to build it locally and push those compiled binaries, as opposed to the uncompiled source files like you might do on a Linux host.
If you have any errors, check your application logs:
$ cf logs my-app --recent
In general, once you’ve built an application in Visual Studio, you’ll want to publish the application in VS (see MSDN instructions) and then push the folder that you’ve published to, and not the root folder for your app.
Cloud Foundry simplifies the process of deploying .NET apps. Try it with your own apps! Check your logs and report any issues to us on GitHub, or on the #Greenhouse channel on the open Cloud Foundry Slack.