Exportar (0) Imprimir
Expandir todo

DiagnosticMonitor.Start (Método) (String, DiagnosticMonitorConfiguration)

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

Espacio de nombres: Microsoft.WindowsAzure.Diagnostics
Ensamblado: Microsoft.WindowsAzure.Diagnostics (en microsoft.windowsazure.diagnostics.dll)

'Uso
Dim diagnosticsStorageAccountConfigurationSettingName As String
Dim initialConfiguration As DiagnosticMonitorConfiguration
Dim returnValue As DiagnosticMonitor

returnValue = DiagnosticMonitor.Start(diagnosticsStorageAccountConfigurationSettingName, initialConfiguration)

public static DiagnosticMonitor Start (
	string diagnosticsStorageAccountConfigurationSettingName,
	DiagnosticMonitorConfiguration initialConfiguration
)
public static DiagnosticMonitor Start (
	String diagnosticsStorageAccountConfigurationSettingName, 
	DiagnosticMonitorConfiguration initialConfiguration
)
public static function Start (
	diagnosticsStorageAccountConfigurationSettingName : String, 
	initialConfiguration : DiagnosticMonitorConfiguration
) : DiagnosticMonitor

Parámetros

diagnosticsStorageAccountConfigurationSettingName

Type: System.String

The name of a configuration setting that provides a connection string to a storage account.

initialConfiguration

Type: DiagnosticMonitorConfiguration

A DiagnosticMonitorConfiguration object that provides a custom initial configuration.

Valor devuelto

Type: DiagnosticMonitor

ADiagnosticMonitor object.

This method starts a DiagnosticMonitor using the specified storage account and DiagnosticMonitorConfiguration object.

Data buffers are transferred to the storage account indicated by the specified configuration setting. The storage account can be the local storage emulator, or a Windows Azure storage account in the cloud. 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(String,DiagnosticMonitorConfiguration) method.

Example

The following code snippet and ServiceConfiguration.cscfg file creates a DiagnosticMonitorConfiguration object, modifies the default configuration, and starts the DiagnosticMonitor by using a Windows Azure storage account in the cloud:

WebRole.cs

public class WebRole : RoleEntryPoint
{
    public override bool OnStart()
    {
        // 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.
        DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmConfig);

        return base.OnStart();
    }
}

ServiceConfiguration.cscfg

<ConfigurationSettings>
   <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"
         value="DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=AccountKey"/>
</ConfigurationSettings>

Cualquier miembro estático público (Shared en Visual Basic) de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Plataformas de desarrollo

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

Plataformas de destino

Adiciones de comunidad

Mostrar:
© 2014 Microsoft