ReplicationServer.ChangeDistributorPassword Metodo

Definizione

Modifica la password del server di distribuzione.

Overload

ChangeDistributorPassword(SecureString)

Modifica la password del server di distribuzione, in cui la nuova password viene fornita come oggetto SecureString.

ChangeDistributorPassword(String)

Modifica la password del server di distribuzione.

ChangeDistributorPassword(SecureString)

Modifica la password del server di distribuzione, in cui la nuova password viene fornita come oggetto SecureString.

public:
 void ChangeDistributorPassword(System::Security::SecureString ^ password);
public void ChangeDistributorPassword (System.Security.SecureString password);
member this.ChangeDistributorPassword : System.Security.SecureString -> unit
Public Sub ChangeDistributorPassword (password As SecureString)

Parametri

password
SecureString

La nuova password del server di distribuzione è un valore SecureString.

Nota sulla sicurezza Quando possibile, richiedere agli utenti di immettere le credenziali di sicurezza in fase di esecuzione. Se è necessario archiviare le credenziali, usare i http://go.microsoft.com/fwlink/?LinkId=34733 servizi di crittografia forniti da Windows .NET Framework.

Commenti

Per impostare questa proprietà, è necessario che la DistributorInstalled proprietà sia true impostata.

Il ChangeDistributorPassword(SecureString) metodo fornisce ulteriore sicurezza per la password mentre è archiviata in memoria e deve essere usato invece di ChangeDistributorPassword(String).

Il ChangeDistributorPassword metodo può essere chiamato dai membri del ruolo predefinito del server sysadmin nel server di distribuzione.

Il ChangeDistributorPassword metodo equivale alla stored procedure sp_changedistributor_password (Transact-SQL).

Si applica a

ChangeDistributorPassword(String)

Modifica la password del server di distribuzione.

public:
 void ChangeDistributorPassword(System::String ^ password);
public void ChangeDistributorPassword (string password);
member this.ChangeDistributorPassword : string -> unit
Public Sub ChangeDistributorPassword (password As String)

Parametri

password
String

Nuova stringa di password per l'account di accesso distributor_admin.

Nota sulla sicurezza Quando possibile, richiedere agli utenti di immettere le credenziali di sicurezza in fase di esecuzione. Se è necessario archiviare le credenziali, usare i http://go.microsoft.com/fwlink/?LinkId=34733 servizi di crittografia forniti da Windows .NET Framework.

Esempio

// Set the Distributor and distribution database names.
string distributionDbName = "distribution";
string distributorName = publisherInstance;

ReplicationServer distributor;
DistributionDatabase distributionDb;

// Create a connection to the Distributor using Windows Authentication.
ServerConnection conn = new ServerConnection(distributorName);

try
{
    // Open the connection. 
    conn.Connect();

    distributor = new ReplicationServer(conn);

    // Load Distributor properties, if it is installed.
    if (distributor.LoadProperties())
    {
        // Password supplied at runtime.
        distributor.ChangeDistributorPassword(password);
        distributor.AgentCheckupInterval = 5;

        // Save changes to the Distributor properties.
        distributor.CommitPropertyChanges();
    }
    else
    {
        throw new ApplicationException(
            String.Format("{0} is not a Distributor.", publisherInstance));
    }

    // Create an object for the distribution database 
    // using the open Distributor connection.
    distributionDb = new DistributionDatabase(distributionDbName, conn);

    // Change distribution database properties.
    if (distributionDb.LoadProperties())
    {
        // Change maximum retention period to 48 hours and history retention 
        // period to 24 hours.
        distributionDb.MaxDistributionRetention = 48;
        distributionDb.HistoryRetention = 24;

        // Save changes to the distribution database properties.
        distributionDb.CommitPropertyChanges();
    }
    else
    {
        // Do something here if the distribution database does not exist.
    }
}
catch (Exception ex)
{
    // Implement the appropriate error handling here. 
    throw new ApplicationException("An error occured when changing Distributor " +
        " or distribution database properties.", ex);
}
finally
{
    conn.Disconnect();
}

Commenti

Per impostare questa proprietà, è necessario che la DistributorInstalled proprietà sia true impostata.

Il ChangeDistributorPassword metodo può essere chiamato dai membri del ruolo predefinito del server sysadmin nel server di distribuzione.

Il ChangeDistributorPassword metodo equivale alla stored procedure sp_changedistributor_password (Transact-SQL).

Vedi anche

Si applica a