Enable Snapshot Debugger for .NET apps in Azure App Service
Snapshot Debugger currently supports ASP.NET and ASP.NET Core apps that are running on Azure App Service on Windows service plans.
Note
We recommend that you run your application on the Basic service tier, or higher, when using Snapshot Debugger. For most applications, the Free and Shared service tiers don't have enough memory or disk space to save snapshots. The Consumption tier is not currently available for Snapshot Debugger.
Enable Snapshot Debugger
Snapshot Debugger is pre-installed as part of the App Services runtime, but you need to turn it on to get snapshots for your App Service app. To enable Snapshot Debugger for an app, follow the instructions below:
Note
If you're using a preview version of .NET Core, or your application references Application Insights SDK (directly or indirectly via a dependent assembly), follow the instructions for Enable Snapshot Debugger for other environments to include the Microsoft.ApplicationInsights.SnapshotCollector
NuGet package with the application.
Note
Codeless installation of Application Insights Snapshot Debugger follows the .NET Core support policy. For more information about supported runtimes, see .NET Core Support Policy.
After you've deployed your .NET app:
Go to the Azure control panel for your App Service.
Go to the Settings > Application Insights page.
Either follow the instructions on the page to create a new resource or select an existing App Insights resource to monitor your app.
Switch Snapshot Debugger toggles to On.
Snapshot Debugger is now enabled using an App Services App Setting.
If you're running a different type of Azure service, here are instructions for enabling Snapshot Debugger on other supported platforms:
- Azure Function
- Azure Cloud Services
- Azure Service Fabric services
- Azure Virtual Machines and Virtual Machine Scale Sets
- On-premises virtual or physical machines
Enable Snapshot Debugger for other clouds
Currently the regions in Azure operated by 21Vianet require endpoint modifications through the Application Insights Connection String.
Connection String Property | Azure operated by 21Vianet |
---|---|
SnapshotEndpoint | https://snapshot.monitor.azure.cn |
For more information about other connection overrides, see Application Insights documentation.
Disable Snapshot Debugger
To disable Snapshot Debugger, repeat the steps for enabling. However, switch the Snapshot Debugger toggles to Off.
Azure Resource Manager template
For an Azure App Service, you can set app settings within the Azure Resource Manager template to enable Snapshot Debugger and Profiler. For example:
{
"apiVersion": "2015-08-01",
"name": "[parameters('webSiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"dependsOn": [
"[variables('hostingPlanName')]"
],
"tags": {
"[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty",
"displayName": "Website"
},
"properties": {
"name": "[parameters('webSiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[parameters('webSiteName')]",
"[concat('AppInsights', parameters('webSiteName'))]"
],
"properties": {
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', concat('AppInsights', parameters('webSiteName'))), '2014-04-01').InstrumentationKey]",
"APPINSIGHTS_PROFILERFEATURE_VERSION": "1.0.0",
"APPINSIGHTS_SNAPSHOTFEATURE_VERSION": "1.0.0",
"DiagnosticServices_EXTENSION_VERSION": "~3",
"ApplicationInsightsAgent_EXTENSION_VERSION": "~2"
}
}
]
},
Not Supported Scenarios
Below you can find scenarios where Snapshot Collector isn't supported:
Scenario | Side Effects | Recommendation |
---|---|---|
You're using the Snapshot Collector SDK in your application directly (.csproj) and have enabled the advanced option "Interop". | The local Application Insights SDK (including Snapshot Collector telemetry) will be lost and no Snapshots will be available. Your application could crash at startup with System.ArgumentException: telemetryProcessorTypedoes not implement ITelemetryProcessor. Learn more about the Application Insights feature "Interop". |
If you're using the advanced option "Interop", use the codeless Snapshot Collector injection (enabled through the Azure portal). |
Next steps
- Generate traffic to your application that can trigger an exception. Then, wait 10 to 15 minutes for snapshots to be sent to the Application Insights instance.
- See snapshots in the Azure portal.
- For help with troubleshooting Snapshot Debugger issues, see Snapshot Debugger troubleshooting.