mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-21 17:16:16 +08:00
738ae1545a
Added Sample project (needed for server). Fixed copyright info. Fixed all "easy" TODOs (or removed if not applicable anymore). Removed HTTP transport settings (HTTP not supported anymore, only HTTPS). Added option to load embedded resources from app directory as embedded resources not supported in .Net Standard.
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Opc.Ua;
|
|
using Opc.Ua.Configuration;
|
|
using Opc.Ua.Sample;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NetCoreConsoleServer
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
try
|
|
{
|
|
ApplicationInstance application = new ApplicationInstance();
|
|
application.ApplicationName = "UA Sample Server";
|
|
application.ApplicationType = ApplicationType.Server;
|
|
application.ConfigSectionName = "Opc.Ua.SampleServer";
|
|
|
|
// load the application configuration.
|
|
Task<ApplicationConfiguration> task = application.LoadApplicationConfiguration(false);
|
|
task.Wait();
|
|
|
|
// check the application certificate.
|
|
Task<bool> task2 = application.CheckApplicationInstanceCertificate(false, 0);
|
|
task2.Wait();
|
|
|
|
// start the server.
|
|
Task task3 = application.Start(new SampleServer());
|
|
task3.Wait();
|
|
|
|
Console.WriteLine("Server Started. Press any key to exit...");
|
|
Console.ReadKey(true);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine("Exit due to Exception: {0}", ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|