DeploymentDiagnosticManager Constructor (String^, String^)
Creates a new instance of the DeploymentDiagnosticManager class.
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)
Parameters
- connectionString
-
Type:
System::String^
Type: System.String
A connection string for a storage account.
- deploymentId
-
Type:
System::String^
Type: System.String
The deployment ID.
The DeploymentDiagnosticManager constructor creates a DeploymentDiagnosticManager object that can manage the running deployment’s diagnostics. You can specify the "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" or another connection string that refers to a storage account specified in your ServiceConfiguration.cscfg file, as well as a deployment ID for the hosted service you want to manage. Once the object has been created, you can get the current diagnostics configuration, change it, or manage on-demand transfers of the diagnostic data to persistent storage.
See Configuring Azure Connection Strings for more information about how to construct a connection string to a storage account.
The following code snippet creates a new deployment diagnostic manager.
// Get the connection string. It's recommended that you store the connection string in your web.config or app.config file. // Use the ConfigurationManager type to retrieve your storage connection string. You can find the account name and key in // the Windows Azure classic portal (http://manage.windowsazure.com). //string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>"; string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString; // You can find the deployment ID, role name, and role instance ID in the // Windows Azure classic portal (http://manage.windowsazure.com). string deploymentId = "28267ed8caf3424eab3f0b01acdd7281"; // Create a DeploymentDiagnosticManager for the deployment. DeploymentDiagnosticManager deploymentDiagnosticManager = new DeploymentDiagnosticManager(connectionString, deploymentId);
Warning |
|---|
This API is not supported in Azure SDK versions 2.5 and higher. Instead, use the diagnostics.wadcfg XML configuration file. For more information, see Collect Logging Data by Using Azure Diagnostics. |
