Connect to the Coordinator with TLS1.2 |
You want to connect to a Coordinator requiring a secured connection.
If the Coordinator and Agent(s) are using secured communications, any client code submitting jobs must also enable the option to use SSL. To do this, set the ClusterJobScheduler's UseSsl property to true. If using self-signed certificates, set the AllowSelfSignedCertificates property to true.
If the Coordinator and Agent(s) are using mutual SSL, any client code must provide a client certificate. To do this, set the ClusterJobScheduler's ProvideClientCertificate property to true. Then, to specify a certificate, set either the ClusterJobScheduler's ClientCertificateName property to the subject distinguished name of a certificate in the local machine's Personal Windows Certificate Store, the ClientCertificateThumbprint property to the SHA1 thumbprint of a certificate in the local machine's Personal Windows Certificate Store, or the ClientCertificateFile property to the path of a certificate file.
To verify the Coordinator's certificate, set the CoordinatorThumbprint property to the Coordinator's certificate thumbprint (found on the Coordinator's connection settings page).
using System; using System.Threading; using AGI.Parallel.Client; using AGI.Parallel.Infrastructure; using AGI.Parallel.Infrastructure.Logging; namespace CodeSamples { class Program { static void Main(string[] args) { using (ClusterJobScheduler scheduler = new ClusterJobScheduler("localhost")) { // Set SSL options before calling Connect() scheduler.UseSsl = true; scheduler.AllowSelfSignedCertificates = false; scheduler.ProvideClientCertificate = true; // Only needed if using mutual SSL scheduler.ClientCertificateName = "CertificateName"; // Only needed if using mutual SSL scheduler.CoordinatorThumbprint = "CoordinatorThumbprint"; // Only needed if the coordinator certificate should be verified. scheduler.Connect(); Job job = scheduler.CreateJob(); Task task = new HelloTask(); job.AddTask(task); job.Submit(); job.WaitUntilDone(); Console.WriteLine("Result = " + task.Result); } } } [Serializable] public class HelloTask : Task { public override void Execute() { Result = "Hello from Task"; } } }
STK Parallel Computing Server 2.9 API for .NET