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
Kullanarak sunucuya bağlantı oluşturma ServerConnection WalkTree
Oluşturma bir örnek , ReplicationServer WalkTreePASS ServerConnection Adım 1.
Oluşturma bir örnek , DistributionDatabase WalkTree
küme Name özellik küme ve veritabanı adı ConnectionContext özelliğine ServerConnection Adım 1.
Dağıtıcı çağırarak yükleme InstallDistributor yöntem.PASS DistributionDatabase Adım 3 nesnesinden.
Oluşturma bir örnek , DistributionPublisher WalkTree
Aşağıdaki özelliklerini DistributionPublisher:
Name-Yayımcı adı.
ConnectionContext- ServerConnection Adım 1.
DistributionDatabase -Adım 5'te oluşturulan veritabanının adı.
WorkingDirectory -anlık görüntü dosyalara erişmek için kullanılan paylaşım.
PublisherSecurity - the security mode used when connecting to the Publisher.WindowsAuthentication is recommended.
Call Create yöntem.
Yayımlama ve dağıtım yapılandırmak için biruzak Dağıtımcı
Kullanarak uzak dağıtımcı sunucuya bir bağlantı oluşturmak ServerConnection WalkTree
Oluşturma bir örnek , ReplicationServer WalkTreePASS ServerConnection Adım 1.
Oluşturma bir örnek , DistributionDatabase WalkTree
küme Name özellik küme ve veritabanı adı ConnectionContext özelliğine ServerConnection Adım 1.
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 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.
Oluşturma bir örnek , DistributionPublisher WalkTree
Aşağıdaki özelliklerini DistributionPublisher:
Name-Yerel Yayımcı sunucunun adı.
ConnectionContext- ServerConnection Adım 1.
DistributionDatabase -Adım 5'te oluşturulan veritabanının adı.
WorkingDirectory -anlık görüntü dosyalara erişmek için kullanılan paylaşım.
PublisherSecurity - the security mode used when connecting to the Publisher.WindowsAuthentication is recommended.
Call Create yöntem.
Yerel Yayımcı sunucuya bir bağlantı oluşturmak ServerConnection WalkTree
Oluşturma bir örnek , ReplicationServer WalkTreePASS ServerConnection Adım 9.
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 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