The following topics will help you to get the most out of Windows Azure Web Sites.
Using Detailed Error Pages with PHP Applications
Detailed Error Messages can help troubleshooting problems in web application hosted on Windows Azure Web Sites. This feature is not only available for ASP.Net application, but also for PHP applications.
To turn on Detailed Error Messages, follow these steps:
1. Logon to the management portal.
2. Click your web site to open the dashboard.
3. Click the Configure tab.
4. Turn on Detailed Error Messages.
5. Click Save.
To download the detailed error pages generated when an error occurs in a PHP application:
1. Logon to the site using an FTP client.
2. Navigate to the LogFiles folder.
3. Download the php_errors.log.
Sample Content of the log
The log contains follow fields:
•Date and time of the error in UTC
•Reason of the error
Consider a PHP page containing the following code:
When browsed, this will generate the following error log:
[11-Dec-2012 01:34:12 UTC] PHP Parse error: syntax error, unexpected ';', expecting ')' in C:\DWASFiles\Sites\HelloWorldWithMySQL\VirtualDirectory0\site\wwwroot\error.php on line 2
Here is a sample from a Joomla site with SQLAzure:
[10-Dec-2012 09:32:15 UTC] PHP Catchable fatal error: Argument 1 passed to JSchemaChangeset::getUpdateQueries() must be an array, boolean given, called in C:\DWASFiles\Sites\WZHAOJOOMLA\VirtualDirectory0\site\wwwroot\libraries\cms\schema\changeset.php on line 63 and defined in C:\DWASFiles\Sites\WZHAOJOOMLA\VirtualDirectory0\site\wwwroot\libraries\cms\schema\changeset.php on line 213
[10-Dec-2012 09:32:15 UTC] PHP Fatal error: sqlsrv_errors contains an invalid type in C:\DWASFiles\Sites\WZHAOJOOMLA\VirtualDirectory0\site\wwwroot\libraries\joomla\database\database\sqlsrv.php on line 677
Using a Custom FastCGI Handler
WAWS supports PHP by default, and it allows you to configure your own FastCGI as well.
1. Deploy your FastCGI executable to the WAWS web site. For example, upload it to the “bin” folder of your web site.
2. Create an ASP file that contains the following content.
Response.Write "<font color=red>" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "</font>"
3. Upload the ASP file to your web site's content folder and open it in IE. You should see the root path of the web site in IE.
•For Azure environment, at this moment, it is C:\DWASFiles\Sites\YourSiteName\VirtualDirectory0\site\wwwroot\.
•For an on-premise environment, at this moment, it is C:\inetpub\temp\DWASFiles\Sites\YourSiteName\VirtualDirectory0\site\wwwroot\.
4. Logon to the management portal and navigate to your web site's dashboard.
5. Click the Configuration tab and scroll down to the bottom. Locate the Handler Mappings section.
6. In the Extension box, type the file extensions that should be processed by your FastCGI. In the Script Processor Path box, type the FastCGI executable's full path. For example, “C:\DWASFiles\Sites\YourSiteName\VirtualDirectory0\site\wwwroot\bin\FastCGI.exe”
7. Save the configuration.
Using Failed Request Tracing to Trace Slow Requests
IIS 7 and later allow you to configure Failed Request Tracing for a Web site, application, or directory by defining tracing rules. There are two types of rules available:
Specifies the status code(s) you want to trace. You can enter multiple status codes in this list by using commas to separate each code. You can also refine your status codes using sub status codes such as "404.2, 500" or a range of sub status codes such as "400-599".
Specifies the maximum time that a request may spend in processing before it is marked as failed and then traced.
For Windows Azure Web Sites (WAWS), this feature can be enabled by turning on Failed Request Tracing in the portal. However, WAWS only traces requests that failed with a status code in the range of 400-600. This rule doesn't trace requests that take a long time with a status code of 200.
To trace both failed (status code > 400) and long requests, follow these steps:
1. Merge the following configuration into your web site's web.config file.
2. In the portal, turn on IIS logging and Failed Request Tracing for your site.
<remove path="*" />
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
<failureDefinitions timeTaken="00:00:10" statusCodes="400-999" />
After this change, the following requests will be traced:
• Requests that take longer than 10 seconds in the IIS pipeline.
-- and --
• Requests with a status code larger than 400.
Azure Application Gallery FAQ
If you are facing an issues with configuring an application on Azure from the Windows Azure Web Application Gallery, please refer to the FAQ in link below:
FAQ About Deployment Credentials
This has come up a couple of times and we have been lucky to have David Ebbo create a Wiki to explain how deployment credentials work in WAWS:
Configure the Web Site to display application errors
The default mode of the ASP.NET customErrors configuration setting is RemoteOnly, which prevents application errors from being displayed. To configure the web site to display application errors create a web.config file and set the mode attribute of customErrors to Off:
- Open Notepad and paste the following text into a new document:
4. <customErrors mode="Off"/>
- Save the contents of this document to the root directory of your web site with the name "web.config":
When an ASP.NET website running on Windows Azure is not configured to display application errors, a web page similar to the following is displayed if an application error occurs:
Without changing the custom errors mode, you may see an error similar to the following when an exception occurs:
HTTP 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occured.
Microsoft Screencasts on Using Windows Azure Web Sites
Here are some screencasts on using Windows Azure Web Sites from Microsoft.
Jim Cheshire | Microsoft
Monday, December 17, 2012 2:47 PMModerator
- Edited by Jim CheshireMicrosoft employee, Moderator Wednesday, January 02, 2013 7:48 PM