다음을 통해 공유


SqlCeReplication.PublisherAddress Property

게시자에 연결할 때 사용되는 네트워크 주소를 지정합니다.

네임스페이스: System.Data.SqlServerCe
어셈블리: System.Data.SqlServerCe(system.data.sqlserverce.dll에 있음)

구문

‘선언
Public Property PublisherAddress As String
public string PublisherAddress { get; set; }
public:
property String^ PublisherAddress {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_PublisherAddress ()

/** @property */
public void set_PublisherAddress (String value)
public function get PublisherAddress () : String

public function set PublisherAddress (value : String)

속성 값

게시자에 연결할 때 사용되는 네트워크 주소입니다.

주의

PublisherNetwork가 DefaultNetwork가 아닌 값으로 설정된 경우 PublisherAddress 속성이 필요합니다.

이 속성을 지정하여 SQL Server Replication Provider와 게시자가 통신하는 방식을 나타냅니다. 예를 들어 SQL Server Compact 3.5 복제 에이전트와 게시자가 서로 다른 두 시스템에 있고 이 두 시스템이 인터넷을 통해 통신하는 경우 PublisherNetworkTcpIpSockets로 설정될 수 있고 PublisherAddress는 특정 IP 주소로 설정될 수 있습니다.

PublisherNetwork 값이 TcpIpSockets 또는 MultiProtocol로 설정될 경우 PublisherAddress 값의 형식은 'IP address,port number'(예: '111.11.11.11,1433')입니다.

다음 예제에서는 SqlCeReplication 개체의 PublisherAddress 속성을 설정합니다.

Dim repl As SqlCeReplication = Nothing

Try
    ' Instantiate and configure SqlCeReplication object
    '
    'NOTE: when possible, prompt users to enter security 
    'credentials at runtime. If you store credentials in a file, 
    'you must secure the file to prevent unauthorized access.
    '
    repl = New SqlCeReplication()
    repl.InternetUrl = "https://www.adventure-works.com/sqlce/sqlcesa35.dll"
    repl.InternetLogin = "MyInternetLogin"
    repl.InternetPassword = "<enterStrongPassword>"
    repl.Publisher = "MyPublisher"
    repl.PublisherDatabase = "MyPublisherDatabase"
    repl.PublisherLogin = "MyPublisherLogin"
    repl.PublisherPassword = "<enterStrongPassword>"
    repl.Publication = "MyPublication"
    repl.Subscriber = "MySubscriber"
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf"

    ' Create the local SQL Mobile Database subscription
    '
    repl.AddSubscription(AddOption.CreateDatabase)

    ' Synchronize to the SQL Server to populate the Subscription 
    '
    repl.Synchronize()
Catch
    ' Handle errors here
    '
Finally
    ' Dispose the repl object
    '
    repl.Dispose()
End Try
SqlCeReplication repl = null;

try
{
    // Instantiate and configure SqlCeReplication object
    //
    //NOTE: when possible, prompt users to enter security 
    //credentials at runtime. If you store credentials in a file, 
    //you must secure the file to prevent unauthorized access.
    //
    repl = new SqlCeReplication();
    repl.InternetUrl = "https://www.adventure-works.com/sqlce/sqlcesa35.dll";
    repl.InternetLogin = "MyInternetLogin";
    repl.InternetPassword = "<enterStrongPassword>";
    repl.Publisher = "MyPublisher";
    repl.PublisherDatabase = "MyPublisherDatabase";
    repl.PublisherLogin = "MyPublisherLogin";
    repl.PublisherPassword = "<enterStrongPassword>";
    repl.Publication = "MyPublication";
    repl.Subscriber = "MySubscriber";
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";

    // Create a local SQL Mobile Database subscription
    //
    repl.AddSubscription(AddOption.CreateDatabase);

    // Synchronize to the SQL Server database
    //
    repl.Synchronize();
}
catch (SqlCeException)
{
    // Handle errors here
    //
}
finally
{
    // Dispose the repl object
    //
    repl.Dispose();
}

스레드 보안

이 유형의 모든 public static(Microsoft Visual Basic의 경우 공유) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.

플랫폼

개발 플랫폼

Windows Vista, Windows Mobile 5.0, Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Mobile 2003 for Pocket PC, Windows CE 5.0
버전 정보
.NET Framework 및 NET Compact Framework
3.5에서 지원됨
.NET Framework
3.0에서 지원됨
.NET Compact Framework 및 .Net Framework
2.0에서 지원됨

참고 항목

참조

SqlCeReplication Class
SqlCeReplication Members
System.Data.SqlServerCe Namespace