다음을 통해 공유


PublisherAddress 속성

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

네임스페이스:  System.Data.SqlServerCe
어셈블리:  System.Data.SqlServerCe.dll의 System.Data.SqlServerCe

구문

‘선언
Public Property PublisherAddress As String
    Get
    Set
‘사용 방법
Dim instance As SqlCeReplication
Dim value As String

value = instance.PublisherAddress

instance.PublisherAddress = value
public string PublisherAddress { get; set; }
public:
property String^ PublisherAddress {
    String^ get ();
    void set (String^ value);
}
member PublisherAddress : string with get, set
function get PublisherAddress () : String
function set PublisherAddress (value : String)

속성 값

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

주의

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

이 속성을 지정하여 SQL Server Replication Provider와 게시자가 통신하는 방식을 나타냅니다. 예를 들어 SQL Server Compact 3.5 복제 에이전트와 게시자가 서로 다른 두 시스템에 있고 이 두 시스템이 인터넷을 통해 통신하는 경우 PublisherNetwork는 TcpIpSockets로 설정될 수 있고 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();
}

참고 항목

참조

SqlCeReplication 클래스

SqlCeReplication 멤버

System.Data.SqlServerCe 네임스페이스