Original article: Hosting FastCGI Applications
Windows Azure supports Internet Information Server (IIS) 7.0 FastCGI module,
This allows developers to run applications developed in interpreted languages, such as PHP or local code.
To obtain a web role host running the FastCGI application, you must:
. Set enableNativeCodeExecution in the service definition file.
. Enable FastCGI in the development environment and Windows Azure
. Package the parser used in your project
IIS 7.0 supports FastCGI standard implementation. For more information about FastCGI usage, see description
Documentation. Http://www.fastcgi.com/drupal/node/6
Enable FastCGI
To enable the IIS FastCGI module, follow these steps:
. Enable CGI on IIS. For more information, see Getting Started with the Windows Azure SDK
Install the following FastCGI tool in IIS 7.0: http://support.microsoft.com/kb/967131.
. Add a configuration file named web. roleConfig to your project.
. Configure FastCGI handlers.
Create a web. roleConfig File
You can use the web. roleConfig file to automatically configure IIS in your local development environment and Windows
Azure runs FastCGI. The path settings in this file point to the web role parser you are using.
To enable FastCGI, include the web. roleConfig file in your root directory and package it with the project.
Release. Note that web. roleConfig is an optional file, which is only required when FastCGI is enabled.
In your web. roleConfig file, specify the absolute path of the parser. To specify this path, you can
Add % RoleRoot % environment variable before the parser file name. % RoleRoot % variable will return the currently running
The absolute path of the role. This path corresponds to the root directory of your web role project and is also the project web. config
The location of the file and web. roleConfig.
The following are some examples of correct web. roleConfig files. In your file, use the relative path and parser
Replace the file name with myinterpreter.exe.
<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<System. webServer>
<FastCgi>
<Application fullPath = "% RoleRoot % \ myinterpreter.exe"/>
</FastCgi>
</System. webServer>
</Configuration>
If you are using Visual Studio to develop and debug your web role, make sure that
Use web. roleConfig In the Content on the property page. To set the Build Action, go to the solution browser.
Right-click the file name, select Properties, and select the value of Content in Build Action.
When you release the project in the development environment or Windows Azure, the values of web. roleConfig will be
Go to the IISapplicationHost. config file and enable CGI.
Note:
You can only use FastCGI settings in the web. roleConfig file. In Windows Azure
Add other server settings to indirectly configure the applicationHost. config file.
Configure Handlers for FastCGI
A handler is used to process a specific resource request. When a request containing the file extension is sent to the server
During Processing, you can configure handler to instruct the parser to process specific extension files. For example
When you use a PHP parser to process requests with A. php extension, you can create a handler to notify IIS
The request is handled by the parser.
You can configure in the project's web. config file, and set web role under the System. webServer Node
To run the FastCGI application. The FastCGI module uses the FastCGI handler you created to process each request.
To add handlers to the web. config file, put the handlers element in system. webServer.
Element. The following example shows how to add a. php file extension handler.
<System. webServer>
...
<Handlers>
...
<Add name = "PHP via FastCGI" path = "*. php "verb =" * "modules =" FastCgiModule "scriptProcessor =" % RoleRoot % \ php \ php-cgi.exe "resourceType =" Unspecified "/>
</Handlers>
</System. webServer>
See IIS 7.0: handlers Element (IIS Settings Schema)
Package the parser with the project
You must put the FastCGI to be used together with your project. To enable Windows Azure to support this parser,
It must be deployed in xcopy mode.
The location of the parser must correspond to the relative path and file name. The file name is specified in webRole. config.
The full path property of the application.
Author: daizhj, Dai zhenjun, LaoD
URL: http://daizhj.cnblogs.com/
Link: http://www.cnblogs.com/daizhj/archive/2009/06/24/1510089.html