Aracılığıyla paylaş


Nasıl yapılır: Yayımlama ve dağıtma (rmo programlama) yapılandırma

Kullanarak çoğaltma yayımlama ve dağıtım program aracılığıyla yapılandırabilirsiniz Çoğaltma Yönetim Nesneleri (rmo).

Tek bir sunucuda yayımlama ve dağıtım yapılandırmak için

  1. Kullanarak sunucuya bağlantı oluşturma ServerConnection WalkTree

  2. Oluşturma bir örnek , ReplicationServer WalkTreePASS ServerConnection Adım 1.

  3. Oluşturma bir örnek , DistributionDatabase WalkTree

  4. küme Name özellik küme ve veritabanı adı ConnectionContext özelliğine ServerConnection Adım 1.

  5. Dağıtıcı çağırarak yükleme InstallDistributor yöntem.PASS DistributionDatabase Adım 3 nesnesinden.

  6. Oluşturma bir örnek , DistributionPublisher WalkTree

  7. Aşağıdaki özelliklerini DistributionPublisher:

  8. Call Create yöntem.

Yayımlama ve dağıtım yapılandırmak için biruzak Dağıtımcı

  1. Kullanarak uzak dağıtımcı sunucuya bir bağlantı oluşturmak ServerConnection WalkTree

  2. Oluşturma bir örnek , ReplicationServer WalkTreePASS ServerConnection Adım 1.

  3. Oluşturma bir örnek , DistributionDatabase WalkTree

  4. küme Name özellik küme ve veritabanı adı ConnectionContext özelliğine ServerConnection Adım 1.

  5. Dağıtıcı çağırarak yükleme InstallDistributor yöntem.(Uzak Dağıtımcı olarak bağlanırken yayımcı tarafından kullanılan) güvenli bir parola belirtin ve DistributionDatabase Adım 3 nesnesinden.Daha fazla bilgi için bkz: Dağıtımcı güvenliğini sağlama.

    Güvenlik notuGüvenlik Notu

    Mümkün olduğunda, zamanında güvenlik kimlik bilgileri bilgilerini girmesini ister.Kimlik bilgileri saklamanız gerekir kullanın Şifreleme Hizmetleri tarafından sağlanan WindowsMicrosoft .net Framework.

  6. Oluşturma bir örnek , DistributionPublisher WalkTree

  7. Aşağıdaki özelliklerini DistributionPublisher:

  8. Call Create yöntem.

  9. Yerel Yayımcı sunucuya bir bağlantı oluşturmak ServerConnection WalkTree

  10. Oluşturma bir örnek , ReplicationServer WalkTreePASS ServerConnection Adım 9.

  11. Call InstallDistributor yöntem.Adım 5'te belirtilen uzak Dağıtımcı adı uzak Dağıtımcı ve parola geçişi.

    Güvenlik notuGüvenlik Notu

    Mümkün olduğunda, zamanında güvenlik kimlik bilgileri bilgilerini girmesini ister.Kimlik bilgileri saklamanız gerekir kullanın Şifreleme Hizmetleri Windows tarafından sağlanan.net Framework.

Örnek

Aşağıdaki örnek bir sunucu ile yerel Dağıtımcı yayımcı olarak yapılandırır.

         // Set the server and database names
            string distributionDbName = "distribution";
            string publisherName = publisherInstance;
            string publicationDbName = "AdventureWorks2008R2";

            DistributionDatabase distributionDb;
            ReplicationServer distributor;
            DistributionPublisher publisher;
            ReplicationDatabase publicationDb;

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

            try
            {
                // Connect to the server acting as the Distributor 
                // and local Publisher.
                conn.Connect();

                // Define the distribution database at the Distributor,
                // but do not create it now.
                distributionDb = new DistributionDatabase(distributionDbName, conn);
                distributionDb.MaxDistributionRetention = 96;
                distributionDb.HistoryRetention = 120;

                // Set the Distributor properties and install the Distributor.
                // This also creates the specified distribution database.
                distributor = new ReplicationServer(conn);
                distributor.InstallDistributor((string)null, distributionDb);

                // Set the Publisher properties and install the Publisher.
                publisher = new DistributionPublisher(publisherName, conn);
                publisher.DistributionDatabase = distributionDb.Name;
                publisher.WorkingDirectory = @"\\" + publisherName + @"\repldata";
                publisher.PublisherSecurity.WindowsAuthentication = true;
                publisher.Create();

                // Enable AdventureWorks as a publication database.
                publicationDb = new ReplicationDatabase(publicationDbName, conn);

                publicationDb.EnabledTransPublishing = true;
                publicationDb.EnabledMergePublishing = true;
            }
            catch (Exception ex)
            {
                // Implement appropriate error handling here.
                throw new ApplicationException("An error occured when installing distribution and publishing.", ex);
            }
            finally
            {
                conn.Disconnect();
            }
' Set the server and database names
Dim distributionDbName As String = "distribution"
Dim publisherName As String = publisherInstance
Dim publicationDbName As String = "AdventureWorks2008R2"

Dim distributionDb As DistributionDatabase
Dim distributor As ReplicationServer
Dim publisher As DistributionPublisher
Dim publicationDb As ReplicationDatabase

' Create a connection to the server using Windows Authentication.
Dim conn As ServerConnection = New ServerConnection(publisherName)

Try
    ' Connect to the server acting as the Distributor 
    ' and local Publisher.
    conn.Connect()

    ' Define the distribution database at the Distributor,
    ' but do not create it now.
    distributionDb = New DistributionDatabase(distributionDbName, conn)
    distributionDb.MaxDistributionRetention = 96
    distributionDb.HistoryRetention = 120

    ' Set the Distributor properties and install the Distributor.
    ' This also creates the specified distribution database.
    distributor = New ReplicationServer(conn)
    distributor.InstallDistributor((CType(Nothing, String)), distributionDb)

    ' Set the Publisher properties and install the Publisher.
    publisher = New DistributionPublisher(publisherName, conn)
    publisher.DistributionDatabase = distributionDb.Name
    publisher.WorkingDirectory = "\\" + publisherName + "\repldata"
    publisher.PublisherSecurity.WindowsAuthentication = True
    publisher.Create()

    ' Enable AdventureWorks as a publication database.
    publicationDb = New ReplicationDatabase(publicationDbName, conn)

    publicationDb.EnabledTransPublishing = True
    publicationDb.EnabledMergePublishing = True

Catch ex As Exception
    ' Implement appropriate error handling here.
    Throw New ApplicationException("An error occured when installing distribution and publishing.", ex)

Finally
    conn.Disconnect()

End Try