Questa pagina è stata utile?
I suggerimenti relativi al contenuto di questa pagina sono importanti. Comunicaceli.
Altri suggerimenti?
1500 caratteri rimanenti
MSDN Library

Metodo DiagnosticMonitor.Start (CloudStorageAccount, DiagnosticMonitorConfiguration)

Starts a diagnostic monitor using the specified storage account and diagnostic monitor configuration.

Spazio dei nomi: Microsoft.WindowsAzure.Diagnostics
Assembly: Microsoft.WindowsAzure.Diagnostics (in microsoft.windowsazure.diagnostics.dll)

'Utilizzo
Dim storageAccount As CloudStorageAccount
Dim initialConfiguration As DiagnosticMonitorConfiguration
Dim returnValue As DiagnosticMonitor

returnValue = DiagnosticMonitor.Start(storageAccount, initialConfiguration)

[EditorBrowsableAttribute(EditorBrowsableState.Advanced)] 
public static DiagnosticMonitor Start (
	CloudStorageAccount storageAccount,
	DiagnosticMonitorConfiguration initialConfiguration
)
/** @attribute EditorBrowsableAttribute(EditorBrowsableState.Advanced) */ 
public static DiagnosticMonitor Start (
	CloudStorageAccount storageAccount, 
	DiagnosticMonitorConfiguration initialConfiguration
)
EditorBrowsableAttribute(EditorBrowsableState.Advanced) 
public static function Start (
	storageAccount : CloudStorageAccount, 
	initialConfiguration : DiagnosticMonitorConfiguration
) : DiagnosticMonitor

Parametri

storageAccount

Type: CloudStorageAccount

A CloudStorageAccount for storing diagnostic data.

initialConfiguration

Type: DiagnosticMonitorConfiguration

A DiagnosticMonitorConfiguration object that provides a custom initial configuration.

Valore restituito

Type: DiagnosticMonitor

Returns DiagnosticMonitor.

Data buffers are transferred to the specified CloudStorageAccount. The DiagnosticMonitorConfiguration object provides specific configuration options for your role instance.

This method also registers the diagnostics monitoring agent for notification when changes to configuration settings occur. If the value of the connection string is changed in the ServiceConfiguration.cscfg file, the diagnostics monitoring agent will be automatically reconfigured to use the new connection.

noteNota
If your storage account is misconfigured, your role instance will start without diagnostics. To ensure that diagnostics will start, verify that your storage account is configured correctly before calling the Start(CloudStorageAccount,DiagnosticMonitorConfiguration) method.

Example

The following code snippet creates a DiagnosticMonitorConfiguration object, modifies the default configuration, and starts the DiagnosticMonitor by using a CloudStorageAccount:

public class WebRole : RoleEntryPoint
{
    public override bool OnStart()
    {
        // Create a CloudStorageAccount object using your credentials.
        StorageCredentialsAccountAndKey credentials = new StorageCredentialsAccountAndKey(accountName, accountKey);
        CloudStorageAccount storageAccount = new CloudStorageAccount(credentials, true);

        // Create a new DiagnosticMonitorConfiguration object.
        DiagnosticMonitorConfiguration dmConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();

        // Transfer the default log containers to a storage account every 30 minutes.
        dmConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);

        // Start the DiagnosticMonitor with the new DiagnosticMonitorConfiguration.
        try
        {
            DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmConfig);
        {
        catch (ArgumentException ae)
        {
            // Handle any exceptions.
            System.Diagnostics.Trace.WriteLine(“Couldn’t start the DiagnosticMonitor.” + ae.Message);
        }

        return base.OnStart();
    }
}

Tutti i membri statici pubblici (Shared in Visual Basic) di questo tipo sono thread-safe. I membri di istanza non sono garantiti come thread-safe.

Piattaforme di sviluppo

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Server 2008 e Windows 2000

Piattaforme di destinazione

Aggiunte alla community

Microsoft sta conducendo un sondaggio in linea per comprendere l'opinione degli utenti in merito al sito Web di MSDN. Se si sceglie di partecipare, quando si lascia il sito Web di MSDN verrà visualizzato il sondaggio in linea.

Si desidera partecipare?
Mostra:
© 2015 Microsoft