- 5 Minutes to read
- Print
- DarkLight
- PDF
Configure Azure App Services
- 5 Minutes to read
- Print
- DarkLight
- PDF
Retrace web application performance monitoring is fully supported on Azure App Services (Web Apps). Application Performance Monitoring (APM) related features supported include identifying slow web pages, slow database queries, and viewing complete method level profile traces.
Some basic monitoring features, such as monitoring IIS metrics, WMI, and performance counters are not supported in Microsoft for App Services, and therefore not supported by Retrace.
Installation Steps for Azure App Services
Retrace is installed as a WebJob that runs on each instance. The WebJob collects the output from the Retrace .NET profiler and uploads it. An Azure Site Extension has been created to simplify the installation process.
Login to the Azure portal and add the Stackify APM site extension. Select App Service > Tools > Extensions > Add.
Select .NET APM Retrace.
In the Azure portal, configure the following application settings:
Key | Required | Notes |
---|---|---|
NEWPROFILER | Recommended | Set to "true" |
Stackify.ApiKey | Required | Use your Stackify Activation Key |
Stackify.AppName | Optional: Defaults to App Service name | MyWebApp Name |
Stackify.Environment | Optional: Defaults to "Production" | Production/Staging/etc (Set per slot) |
Stackify.CollectIISLogs | Optional: Defaults to 0 | Further instructions below |
StackifyPath | Required for Custom Instrumentation | Set this variable to the root of the application if Custom Instrumentation is being used |
WEBSITE_LOAD_USER_PROFILE | Required with the new profiler for .NET full framework apps | Value: 1 |
COMPLUS_LoaderOptimization | Required with the new profiler for .NET full framework apps | Value: 1 |
When using ConfigurationManager, you must set the following environment variable
StackifyAppSettingNonReadable = 1
IMPORTANT: Restart your App Service via the Azure portal. The webjob will not begin to start collecting profiler output until this has been done.
3. Generate some traffic to your site.
Performance data should show up within a few minutes.
Multiple deployment slots
If you are using multiple deployment slots, install the site extension for each deployment slot. Since site extensions are part of what is swapped, this is required so everything works correctly when you swap slots.
Make sure you properly configure Stackify.Environment
in the Application Settings of your App Service so that we can identify which slot is which.
Controlling App Name and Environment
By default, the app name is the same name that would be:
<your app>.cloudapp.net
By default, the environment name for all Azure web apps is Production. To override this behavior and set the name, specify a name in your web.config
or the azure portal application settings.
Stackify.AppName=MyWebApp
Stackify.Environment=Staging
Set
Stackify.Environment
for each of your deployment slots and make it a sticky setting per slot.
Collecting IIS Logs
If you are using Retrace error and log management solution, you can have the Stackify WebJob collect your IIS logs and upload them automatically by enabling the log collector feature in Stackify across all servers, or you can enable for a particular app by setting an Azure portal application setting. Azure portal application settings to enable or disable IIS log collection:
Stackify.CollectIISLogs=1
(or 0 to disable)
You must enable web server logs in the Azure portal for your app for this to work.
Updating Retrace on Azure Web Apps
Updates are released periodically. The Stackify WebJob has been designed so that every time it starts, it checks for the latest version and downloads it. Restarting your Azure WebApp forced it to update, although some changes may not take effect until your app is restarted again after the WebJob makes changes.
Web Deployment Task Failed Error
If you are trying to deploy your application and getting an error about StackifyWebJob files being locked, you might need to modify your deployment settings. Stackify runs as a WebJob that is installed through the Azure Site Extension in to your App_Data folder.
If you are trying to use the optional deployment setting to Remove additional files at destination, this tries to remove the WebJob.
Possible error:
Web deployment task failed. (Web Deploy cannot modify the file 'StackifyWebJob' on the destination because it is locked by an external process.
To fix this, go to the Visual Studio UI publish options and select "Exclude files from the App_Data folder" so the Stackify WebJob is not affected by the deployment.
Troubleshooting
Due to the “sandbox” nature of Azure Web Apps, debugging can be difficult and can be made more difficult in a scaled website with more than one running instance. Stackify WebJob and .NET profiler both have log files. The Stackify support team may ask for your assistance to retrieve them. They are accessed through the Azure Kudu console.
D:\local\Stackify\StackifyWebJob\stackify.log
(rotating file log, may be more than one file). To get to this location, see this documentation on how to use the Kudu Debug Console for Azure Web Apps. Along with your log files are some common troubleshooting steps for your Azure Web App to try as well.
Uninstalling Retrace for Azure Web Apps
Stackify is installed as an Azure Site Extension that installs a WebJob and a .NET CLR profiler. To disable Stackify on your Azure Web App, delete the Azure Site Extension from each deployment slot and restart your app. This automatically deletes the WebJob and disables the CLR profiler.
If you are having a lot of problems with your app and need to disable the Stackify and all other site extensions, configure this Application Setting using the Azure Portal to disable all of them:
WEBSITE_PRIVATE_EXTENSIONS=0
Complete the following advanced steps to verify that everything is removed:
- Via the Azure portal, delete the Retrace APM site extension for your web app on each deployment slot on which it was installed.
- Make sure that the StackifyWebJob was properly deleted by viewing the list of WebJobs for your web app.
- In Kudu, make sure that the folder under D:\home\SiteExtensions\Stackify.AzureWebApps is deleted
- Delete everything under D:\home\stackify.
- Delete StackifyHttpTracer.dll from the bin folder of your app.
If you are having serious problems and ugently need to disable Retrace, create a new deployment slot that does not have the Stackify extension in it. Redeploy your app to that slot and swap it to production, then delete the old slot and recreate it.
Having problems with Retrace and your Azure App Service?
Check out the article about common problems with Azure App Services: Troubleshoot: Common Azure App Service Issues