Nasıl yapılır: Web eşitleme (rmo programlama) kullanmak için bir abonelik yapılandırma
Bu konudaki yordam, yapılandırma Web üzerinden eşitleme için birleştirme üçüncü adımıdır çoğaltma.yayın etkinleştirmek ve çalıştıran bilgisayarı yapılandırmak sonra bu adımı gerçekleştirmeniz Microsoft Internet Information Services (IIS).Yapılandırma işlemine genel bakış için bkz: Nasıl yapılır: Birleştirme çoğaltma (rmo programlama) Web eşitleme Yapılandır.Yalnızca bağlanabilir aboneleri için Web üzerinden eşitleme kullanmak için bir abonelik yapılandırma ne zaman Yayımcı http yayın düzgün şekilde yapılandırmalısınız.Daha fazla bilgi için bkz: Nasıl yapılır: Web eşitleme (rmo programlama) izin vermek için yayını yapılandırma.Bu konudaki yordamları tamamladıktan sonra oluşturduğunuz abonelik eşitleyin.Daha fazla bilgi için bkz: Nasıl yapılır: Çekme abonelik (rmo programlama) Eşitle.
Bu konuda tarafından Web üzerinden eşitleme için gerekli olan parametreleri açıklar.Çekme abonelikleri oluşturma hakkında daha fazla bilgi için bkz: Nasıl yapılır: Çekme abonelik (rmo programlama) oluştur.
![]() |
---|
Web sunucusu Web üzerinden eşitleme için kullanılan url (https:// gibiserver.etki alanı.com /dizini/replisapi.dll) replisapi.dll konumunu belirtir.Sunucu Güvenli Yuva Katmanı (ssl) için varsayılan bağlantı noktası 443'den farklı bir bağlantı noktası kullanmak üzere yapılandırılmışsa, bağlantı noktası da sağlamanız gerekir: https://server.etki alanı.com:BağlantıNoktasıNumarası/dizini/replisapi.dll.URL'deki sunucu adını sertifika oluşturulduğunda kullanılan adıyla aynı olması gerekir.Örneğin, bir intranet üzerinde https:// bir Web sunucusuna erişmek mümkün olabilirserver/.Ancak, tam adı (https:// gibiserver.etki alanı.com/) sertifika oluşturulduğunda kullanılan URL'de bu tam adı kullanmanız gerekir (https://server.etki alanı.com /dizini/replisapi.dll). |
Bir abonelik Web üzerinden eşitleme kullanmak üzere yapılandırmak için
Abone ve Yayımcı bağlantılar kullanarak oluşturmak ServerConnection WalkTree
Oluşturma bir örnek , MergePublication 1. adımdaki Yayımcı bağlantısı kullanarak sınıf.
(İsteğe bağlı) sql Server Yönetim Nesneleri (smo) kullanarak veritabanı abonelik veritabanı yoksa, oluşturun Database WalkTreeDaha fazla bilgi için bkz: Oluşturma, değiştirme ve veritabanları kaldırma.
Oluşturma bir örnek , MergePullSubscription WalkTree
Aşağıdaki abonelik özelliklerini ayarlayın:
The ServerConnection to the Subscriber that was created in step 1 for ConnectionContext.
Abonelik veritabanı adı DatabaseName.
Adı Yayımcı için PublisherName.
yayın veritabanı için adını PublicationDBName.
yayın adını PublicationName.
Value of true for UseWebSynchronization.
Web üzerinden eşitleme barındıran Web sunucusunun konumunu InternetUrl.
Oturum açma ve parola Birleştirme Aracısı çalıştığı için abone adresindeki Windows hesabı için Login ve Password alanları, SynchronizationAgentProcessSecurity, sırasıyla.Birleştirme Aracısı bağlantıları için yerel abone yaptığında, bu hesap da kullanılır.
Not
üye tarafından yayın oluşturulduğunda sysadmin sabit sunucu rolü, size gerekmez küme SnapshotGenerationAgentProcessSecurity.Daha fazla bilgi için bkz: Çoğaltma aracısı güvenlik modeli.
İçin 0 değeri InternetSecurityMode ve aynı zamanda değerleri için InternetLogin ve InternetPassword zaman http temel kimlik doğrulaması kullanılır erişim Web server.Web üzerinden eşitleme için bu kimlik doğrulaması yöntem kullanmanızı öneririz.Daha fazla bilgi için bkz: Internet üzerinden çoğaltma güvenliğini sağlama.
Call Create yöntem.
Kullanarak örnek , MergePublication 2. adımdaki çağrısı MakePullSubscriptionWellKnown yöntem ile istek temelli abonelik kaydetmek içinYayımcı.
Yalnızca bağlanabilir aboneleri için Web üzerinden eşitleme kullanmak için bir abonelik yapılandırma Yayımcı http kullanarak bir Web sunucusu aracılığıyla
Abone bir bağlantı kullanarak oluşturmak ServerConnection WalkTree
(İsteğe bağlı) smo kullanarak veritabanı abonelik veritabanı yoksa, oluşturun Database WalkTreeDaha fazla bilgi için bkz: Oluşturma, değiştirme ve veritabanları kaldırma.
Oluşturma bir örnek , MergePullSubscription WalkTree
Aşağıdaki abonelik özelliklerini ayarlayın:
The ServerConnection created in step 1 for ConnectionContext.
Abonelik veritabanı adı DatabaseName.
Adı Yayımcı için PublisherName.
yayın veritabanı için adını PublicationDBName.
yayın adını PublicationName.
A value of Anonymous for SubscriberType.
Value of true for UseWebSynchronization.
Web üzerinden eşitleme barındıran Web sunucusunun konumunu InternetUrl.
Oturum açma ve parola Birleştirme Aracısı çalıştığı için abone adresindeki Windows hesabı için Login ve Password alanları, SynchronizationAgentProcessSecurity, sırasıyla.Birleştirme Aracısı bağlantıları için yerel abone yaptığında, bu hesap da kullanılır.
Not
üye tarafından yayın oluşturulduğunda sysadmin sabit sunucu rolü, size gerekmez küme SnapshotGenerationAgentProcessSecurity.Daha fazla bilgi için bkz: Çoğaltma aracısı güvenlik modeli.
İçin 0 değeri InternetSecurityMode ve aynı zamanda değerleri için InternetLogin ve InternetPassword zaman http temel kimlik doğrulaması kullanılır erişim Web.Web üzerinden eşitleme için bu kimlik doğrulaması yöntem kullanmanızı öneririz.Daha fazla bilgi için bkz: Internet üzerinden çoğaltma güvenliğini sağlama.
Call Create yöntem.
Örnek
Aşağıdaki örnek Web üzerinden eşitleme kullanarak yayımcı ile eşitlenmiş abonelik oluşturur.
// Define the Publisher, publication, and databases.
string publicationName = "AdvWorksSalesOrdersMerge";
string publisherName = publisherInstance;
string subscriberName = subscriberInstance;
string subscriptionDbName = "AdventureWorks2008R2Replica";
string publicationDbName = "AdventureWorks2008R2";
string hostname = @"adventure-works\garrett1";
string webSyncUrl = "https://" + publisherInstance + "/WebSync/replisapi.dll";
//Create connections to the Publisher and Subscriber.
ServerConnection subscriberConn = new ServerConnection(subscriberName);
ServerConnection publisherConn = new ServerConnection(publisherName);
// Create the objects that we need.
MergePublication publication;
MergePullSubscription subscription;
try
{
// Connect to the Subscriber.
subscriberConn.Connect();
// Ensure that the publication exists and that
// it supports pull subscriptions and Web synchronization.
publication = new MergePublication();
publication.Name = publicationName;
publication.DatabaseName = publicationDbName;
publication.ConnectionContext = publisherConn;
if (publication.LoadProperties())
{
if ((publication.Attributes & PublicationAttributes.AllowPull) == 0)
{
publication.Attributes |= PublicationAttributes.AllowPull;
}
if ((publication.Attributes & PublicationAttributes.AllowWebSynchronization) == 0)
{
publication.Attributes |= PublicationAttributes.AllowWebSynchronization;
}
// Define the pull subscription.
subscription = new MergePullSubscription();
subscription.ConnectionContext = subscriberConn;
subscription.PublisherName = publisherName;
subscription.PublicationName = publicationName;
subscription.PublicationDBName = publicationDbName;
subscription.DatabaseName = subscriptionDbName;
subscription.HostName = hostname;
// Specify the Windows login credentials for the Merge Agent job.
subscription.SynchronizationAgentProcessSecurity.Login = winLogin;
subscription.SynchronizationAgentProcessSecurity.Password = winPassword;
// Enable Web synchronization.
subscription.UseWebSynchronization = true;
subscription.InternetUrl = webSyncUrl;
// Specify the same Windows credentials to use when connecting to the
// Web server using HTTPS Basic Authentication.
subscription.InternetSecurityMode = AuthenticationMethod.BasicAuthentication;
subscription.InternetLogin = winLogin;
subscription.InternetPassword = winPassword;
// Ensure that we create a job for this subscription.
subscription.CreateSyncAgentByDefault = true;
// Create the pull subscription at the Subscriber.
subscription.Create();
Boolean registered = false;
// Verify that the subscription is not already registered.
foreach (MergeSubscription existing
in publication.EnumSubscriptions())
{
if (existing.SubscriberName == subscriberName
&& existing.SubscriptionDBName == subscriptionDbName
&& existing.SubscriptionType == SubscriptionOption.Pull)
{
registered = true;
}
}
if (!registered)
{
// Register the local subscription with the Publisher.
publication.MakePullSubscriptionWellKnown(
subscriberName, subscriptionDbName,
SubscriptionSyncType.Automatic,
MergeSubscriberType.Local, 0);
}
}
else
{
// Do something here if the publication does not exist.
throw new ApplicationException(String.Format(
"The publication '{0}' does not exist on {1}.",
publicationName, publisherName));
}
}
catch (Exception ex)
{
// Implement the appropriate error handling here.
throw new ApplicationException(String.Format(
"The subscription to {0} could not be created.", publicationName), ex);
}
finally
{
subscriberConn.Disconnect();
publisherConn.Disconnect();
}
' Define the Publisher, publication, and databases.
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publisherName As String = publisherInstance
Dim subscriberName As String = subscriberInstance
Dim subscriptionDbName As String = "AdventureWorks2008R2Replica"
Dim publicationDbName As String = "AdventureWorks2008R2"
Dim hostname As String = "adventure-works\garrett1"
Dim webSyncUrl As String = "https://" + publisherInstance + "/WebSync/replisapi.dll"
'Create connections to the Publisher and Subscriber.
Dim subscriberConn As ServerConnection = New ServerConnection(subscriberName)
Dim publisherConn As ServerConnection = New ServerConnection(publisherName)
' Create the objects that we need.
Dim publication As MergePublication
Dim subscription As MergePullSubscription
Try
' Connect to the Subscriber.
subscriberConn.Connect()
' Ensure that the publication exists and that
' it supports pull subscriptions and Web synchronization.
publication = New MergePublication()
publication.Name = publicationName
publication.DatabaseName = publicationDbName
publication.ConnectionContext = publisherConn
If publication.LoadProperties() Then
If (publication.Attributes And PublicationAttributes.AllowPull) = 0 Then
publication.Attributes = publication.Attributes _
Or PublicationAttributes.AllowPull
End If
If (publication.Attributes And PublicationAttributes.AllowWebSynchronization) = 0 Then
publication.Attributes = publication.Attributes _
Or PublicationAttributes.AllowWebSynchronization
End If
' Define the pull subscription.
subscription = New MergePullSubscription()
subscription.ConnectionContext = subscriberConn
subscription.PublisherName = publisherName
subscription.PublicationName = publicationName
subscription.PublicationDBName = publicationDbName
subscription.DatabaseName = subscriptionDbName
subscription.HostName = hostname
subscription.CreateSyncAgentByDefault = True
' Specify the Windows login credentials for the Merge Agent job.
subscription.SynchronizationAgentProcessSecurity.Login = winLogin
subscription.SynchronizationAgentProcessSecurity.Password = winPassword
' Enable Web synchronization.
subscription.UseWebSynchronization = True
subscription.InternetUrl = webSyncUrl
' Specify the same Windows credentials to use when connecting to the
' Web server using HTTPS Basic Authentication.
subscription.InternetSecurityMode = AuthenticationMethod.BasicAuthentication
subscription.InternetLogin = winLogin
subscription.InternetPassword = winPassword
' Create the pull subscription at the Subscriber.
subscription.Create()
Dim registered As Boolean = False
' Verify that the subscription is not already registered.
For Each existing As MergeSubscription In _
publication.EnumSubscriptions()
If existing.SubscriberName = subscriberName Then
registered = True
End If
Next
If Not registered Then
' Register the local subscription with the Publisher.
publication.MakePullSubscriptionWellKnown( _
subscriberName, subscriptionDbName, _
SubscriptionSyncType.Automatic, _
MergeSubscriberType.Local, 0)
End If
Else
' Do something here if the publication does not exist.
Throw New ApplicationException(String.Format( _
"The publication '{0}' does not exist on {1}.", _
publicationName, publisherName))
End If
Catch ex As Exception
' Implement the appropriate error handling here.
Throw New ApplicationException(String.Format( _
"The subscription to {0} could not be created.", publicationName), ex)
Finally
subscriberConn.Disconnect()
publisherConn.Disconnect()
End Try
Bu örnek, yalnızca yayımcıya http kullanarak bir Web sunucusu aracılığıyla bağlanabilir bir abone için Web üzerinden eşitleme kullanarak yayımcı ile eşitlenmiş abonelik oluşturur.
// The publication must support anonymous Subscribers, pull
// subscriptions, and Web synchronization.
// Define the Publisher, publication, and databases.
string publicationName = "AdvWorksSalesOrdersMerge";
string publisherName = publisherInstance;
string subscriberName = subscriberInstance;
string subscriptionDbName = "AdventureWorks2008R2Replica";
string publicationDbName = "AdventureWorks2008R2";
string hostname = @"adventure-works\garrett1";
string webSyncUrl = "https://" + publisherInstance + "/WebSync/replisapi.dll";
//Create the Subscriber connection.
ServerConnection conn = new ServerConnection(subscriberName);
// Create the objects that we need.
MergePullSubscription subscription;
try
{
// Connect to the Subscriber.
conn.Connect();
// Define the pull subscription.
subscription = new MergePullSubscription();
subscription.ConnectionContext = conn;
subscription.PublisherName = publisherName;
subscription.PublicationName = publicationName;
subscription.PublicationDBName = publicationDbName;
subscription.DatabaseName = subscriptionDbName;
subscription.HostName = hostname;
// Specify an anonymous Subscriber type since we can't
// register at the Publisher with a direct connection.
subscription.SubscriberType = MergeSubscriberType.Anonymous;
// Specify the Windows login credentials for the Merge Agent job.
subscription.SynchronizationAgentProcessSecurity.Login = winLogin;
subscription.SynchronizationAgentProcessSecurity.Password = winPassword;
// Enable Web synchronization.
subscription.UseWebSynchronization = true;
subscription.InternetUrl = webSyncUrl;
// Specify the same Windows credentials to use when connecting to the
// Web server using HTTPS Basic Authentication.
subscription.InternetSecurityMode = AuthenticationMethod.BasicAuthentication;
subscription.InternetLogin = winLogin;
subscription.InternetPassword = winPassword;
// Ensure that we create a job for this subscription.
subscription.CreateSyncAgentByDefault = true;
// Create the pull subscription at the Subscriber.
subscription.Create();
}
catch (Exception ex)
{
// Implement the appropriate error handling here.
throw new ApplicationException(String.Format(
"The subscription to {0} could not be created.", publicationName), ex);
}
finally
{
conn.Disconnect();
}
' The publication must support anonymous Subscribers, pull
' subscriptions, and Web synchronization.
' Define the Publisher, publication, and databases.
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publisherName As String = publisherInstance
Dim subscriberName As String = subscriberInstance
Dim subscriptionDbName As String = "AdventureWorks2008R2Replica"
Dim publicationDbName As String = "AdventureWorks2008R2"
Dim hostname As String = "adventure-works\\garrett1"
Dim webSyncUrl As String = "https://" + publisherInstance + "/WebSync/replisapi.dll"
'Create the Subscriber connection.
Dim conn As ServerConnection = New ServerConnection(subscriberName)
' Create the objects that we need.
Dim subscription As MergePullSubscription
Try
' Connect to the Subscriber.
conn.Connect()
' Define the pull subscription.
subscription = New MergePullSubscription()
subscription.ConnectionContext = conn
subscription.PublisherName = publisherName
subscription.PublicationName = publicationName
subscription.PublicationDBName = publicationDbName
subscription.DatabaseName = subscriptionDbName
subscription.HostName = hostname
' Specify an anonymous Subscriber type since we can't
' register at the Publisher with a direct connection.
subscription.SubscriberType = MergeSubscriberType.Anonymous
' Specify the Windows login credentials for the Merge Agent job.
subscription.SynchronizationAgentProcessSecurity.Login = winLogin
subscription.SynchronizationAgentProcessSecurity.Password = winPassword
' Enable Web synchronization.
subscription.UseWebSynchronization = True
subscription.InternetUrl = webSyncUrl
' Specify the same Windows credentials to use when connecting to the
' Web server using HTTPS Basic Authentication.
subscription.InternetSecurityMode = AuthenticationMethod.BasicAuthentication
subscription.InternetLogin = winLogin
subscription.InternetPassword = winPassword
' Ensure that we create a job for this subscription.
subscription.CreateSyncAgentByDefault = True
' Create the pull subscription at the Subscriber.
subscription.Create()
Catch ex As Exception
' Implement the appropriate error handling here.
Throw New ApplicationException(String.Format( _
"The subscription to {0} could not be created.", publicationName), ex)
Finally
conn.Disconnect()
End Try