The Windows Azure CGI Web Role Template Explained
Many of you may not even know this, but as part of the Windows Azure Tools for Microsoft Visual Studio, we ship a Role template called “CGI Web Role”.
Today, it’s a little hard to find (yes, I’m foreshadowing that this is about to change!) as you have to create a Cloud Service project first, then add/replace the Web Role with a CGI Web Role.
For example you could create a Blank Cloud Service project:
In Solution Explorer, right click on the Roles node in the Cloud Service project Add | New Web Role Project…
Select CGI Web Role:
Which adds an ASP.NET Web Application project tailored to be the configuration and files conduit for a FastCGI Application to your Cloud Service:
What is the purpose of the CGI Web Role?
Even though Visual Studio doesn’t support languages like PHP, there are reasons for you to be interested in using Visual Studio when building a FastCGI application that runs on Windows Azure:
- Includes the Web.roleconfig file which is used to specify the FastCGI application
- Has a commented section in the web.config that describes how to add the FastCGI handler.
- Running on the DevFabric
- Once you have the project setup, you can hit F5 and have your application run on the DevFabric. Stop, edit and run it again with ease.
- Packaging for deployment
- Right click on the Cloud Service project in the Solution Explorer and select “Publish” – this will package your application for deployment.
Not to mention that Visual Studio really has a first class source editor and a lot of other features you’ll be able to make use of.