Aracılığıyla paylaş


Bitiş noktaları uygulama

Bir son nokta doğal istekleri dinleyebilirsiniz bir hizmettir. smo kullanarak bitiş noktaları için çeşitli tür destekler Endpointnesnesini. Sen-ebilmek yaratmak bir bitiş noktası hizmeti örneğini oluşturarak belirli bir iletişim kuralı kullanan yük, belirli bir tür işleyen bir Endpointve nesne özelliklerini ayarlama.

EndpointTypeÖzelliği Endpointnesne üzerinde aşağıdaki yükü türlerini belirtmek için kullanılabilir:

  • Veritabanı yansıtma

  • SABUN

  • Service Broker

  • Transact-SQL

Ayrıca, ProtocolTypeözelliği, aşağıdaki iki desteklenen protokolleri belirtmek için kullanılabilir:

  • http protokolü.

  • Protokolü

Yük türü belirtilen, gerçek yükü kullanılarak ayarlanabilir Payloadnesne özelliği. PayloadNesne özelliği, belirtilen türdeki özellikleri değiştirilebilir yük nesnesine bir başvuru sağlar.

İçin DatabaseMirroringPayloadnesnesi belirtmeniz gerekir yansıtma rolü ve şifreleme etkinleştirilip etkinleştirilmediği. ServiceBrokerPayloadNesne ileti iletmeyi, izin verilen en fazla sayısını ve kimlik doğrulama modu hakkında bilgi gerektirir. SoapPayloadMethodNesne gerektirir ayarlamak için çeşitli özellikleri de dahil olmak üzere Addnesne özelliği soap yükü yöntemleri (saklı yordamları ve kullanıcı tanımlı işlevler) istemcilerin kullanımına belirtir.

Benzer şekilde, fiili protokolü kullanılarak ayarlanabilir Protocolnesne özelliği bir protokol nesnesi tarafından belirtilen türde başvuran ProtocolTypeözellik. HttpProtocolNesne sınırlı IP adresleri ve bağlantı noktası, Web sitesi ve kimlik bilgileri bir liste gerektirir. TcpProtocolNesne de sınırlı IP adresi ve bağlantı noktası bilgileri listesi gerektirir.

Bitiş noktası oluşturduğunuzda ve tam olarak tanımlanan erişim verilen, gelen iptal edilmiş ve veritabanı kullanıcıları, grupları, rolleri ve oturumları engellendi.

Örnek

Aşağıdaki kod örneği için Java programlama ortamı seçin şablon ve programlama dili uygulamanızı oluşturmak için programlama gerekir. Daha fazla bilgi için Visual Studio'da Visual Basic smo proje oluşturun.NETve Visual Studio'da Visual C# smo proje oluşturun.NET.

Visual Basic'te Service Endpoint yansıtma veritabanı oluşturma

Kod örneği, smo Veritabanı yansıtma bir son nokta oluşturmak gösterilmiştir. Veritabanı yansıtma oluşturmadan önce bu işlem gereklidir. Kullanım IsMirroringEnabledve diğer özellikleri Databasenesne bir veritabanı yansıtma oluşturmak için.

'Set up a database mirroring endpoint on the server before setting up a database mirror.
'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Define an Endpoint object variable for database mirroring.
Dim ep As Endpoint
ep = New Endpoint(srv, "Mirroring_Endpoint")
ep.ProtocolType = ProtocolType.Tcp
ep.EndpointType = EndpointType.DatabaseMirroring
'Specify the protocol ports.
ep.Protocol.Http.SslPort = 5024
ep.Protocol.Tcp.ListenerPort = 6666
'Specify the role of the payload.
ep.Payload.DatabaseMirroring.ServerMirroringRole = ServerMirroringRole.All
'Create the endpoint on the instance of SQL Server.
ep.Create()
'Start the endpoint.
ep.Start()
Console.WriteLine(ep.EndpointState)

Visual C# Service Endpoint yansıtma veritabanı oluşturma

Kod örneği, smo Veritabanı yansıtma bir son nokta oluşturmak gösterilmiştir. Veritabanı yansıtma oluşturmadan önce bu işlem gereklidir. Kullanım IsMirroringEnabledve diğer özellikleri Databasenesne bir veritabanı yansıtma oluşturmak için.

{
            //Set up a database mirroring endpoint on the server before 
        //setting up a database mirror. 
        //Connect to the local, default instance of SQL Server. 
            Server srv = new Server();
            //Define an Endpoint object variable for database mirroring. 
            Endpoint ep = default(Endpoint);
            ep = new Endpoint(srv, "Mirroring_Endpoint");
            ep.ProtocolType = ProtocolType.Tcp;
            ep.EndpointType = EndpointType.DatabaseMirroring;
            //Specify the protocol ports. 
            ep.Protocol.Http.SslPort = 5024;
            ep.Protocol.Tcp.ListenerPort = 6666;
            //Specify the role of the payload. 
            ep.Payload.DatabaseMirroring.ServerMirroringRole = ServerMirroringRole.All;
            //Create the endpoint on the instance of SQL Server. 
            ep.Create();
            //Start the endpoint. 
            ep.Start();
            Console.WriteLine(ep.EndpointState);
        }

{
            //Set up a database mirroring endpoint on the server before 
        //setting up a database mirror. 
        //Connect to the local, default instance of SQL Server. 
            Server srv = new Server();
            //Define an Endpoint object variable for database mirroring. 
            Endpoint ep = default(Endpoint);
            ep = new Endpoint(srv, "Mirroring_Endpoint");
            ep.ProtocolType = ProtocolType.Tcp;
            ep.EndpointType = EndpointType.DatabaseMirroring;
            //Specify the protocol ports. 
            ep.Protocol.Http.SslPort = 5024;
            ep.Protocol.Tcp.ListenerPort = 6666;
            //Specify the role of the payload. 
            ep.Payload.DatabaseMirroring.ServerMirroringRole = ServerMirroringRole.All;
            //Create the endpoint on the instance of SQL Server. 
            ep.Create();
            //Start the endpoint. 
            ep.Start();
            Console.WriteLine(ep.EndpointState);
        }

PowerShell hizmet bitiş noktası yansıtma veritabanı oluşturma

Kod örneği, smo Veritabanı yansıtma bir son nokta oluşturmak gösterilmiştir. Veritabanı yansıtma oluşturmadan önce bu işlem gereklidir. Kullanım IsMirroringEnabledve diğer özellikleri Databasenesne bir veritabanı yansıtma oluşturmak için.

# Set the path context to the local, default instance of SQL Server.
CD \sql\localhost\
$srv = get-item default

#Get a new endpoint to congure and add
$ep = New-Object -TypeName Microsoft.SqlServer.Management.SMO.Endpoint -argumentlist $srv,"Mirroring_Endpoint"

#Set some properties
$ep.ProtocolType = [Microsoft.SqlServer.Management.SMO.ProtocolType]::Tcp
$ep.EndpointType = [Microsoft.SqlServer.Management.SMO.EndpointType]::DatabaseMirroring
$ep.Protocol.Http.SslPort = 5024
$ep.Protocol.Tcp.ListenerPort = 6666 #inline comment
$ep.Payload.DatabaseMirroring.ServerMirroringRole = [Microsoft.SqlServer.Management.SMO.ServerMirroringRole]::All

# Create the endpoint on the instance
$ep.Create()

# Start the endpoint
$ep.Start()

# Report its state
$ep.EndpointState;

# Set the path context to the local, default instance of SQL Server.
CD \sql\localhost\
$srv = get-item default

#Get a new endpoint to congure and add
$ep = New-Object -TypeName Microsoft.SqlServer.Management.SMO.Endpoint -argumentlist $srv,"Mirroring_Endpoint"

#Set some properties
$ep.ProtocolType = [Microsoft.SqlServer.Management.SMO.ProtocolType]::Tcp
$ep.EndpointType = [Microsoft.SqlServer.Management.SMO.EndpointType]::DatabaseMirroring
$ep.Protocol.Http.SslPort = 5024
$ep.Protocol.Tcp.ListenerPort = 6666 #inline comment
$ep.Payload.DatabaseMirroring.ServerMirroringRole = [Microsoft.SqlServer.Management.SMO.ServerMirroringRole]::All

# Create the endpoint on the instance
$ep.Create()

# Start the endpoint
$ep.Start()

# Report its state
$ep.EndpointState;

Ayrıca bkz.

Kavramlar

Veritabanı yansıtma bitiş noktası (SQL Server)

Diğer Kaynaklar

Service Broker Endpoints