fix mono test scrip and client

This commit is contained in:
Martin Regen
2018-01-12 16:06:48 +01:00
parent 2acfcc0a30
commit 714924856d
4 changed files with 42 additions and 19 deletions
@@ -42,7 +42,9 @@ namespace NetCoreConsoleClient
public static int Main(string[] args)
{
Console.WriteLine(".Net Core OPC UA Console Client sample");
Console.WriteLine(
(Utils.IsRunningOnMono() ? "Mono" : ".Net Core") +
" OPC UA Console Client sample");
// command line options
bool showHelp = false;
@@ -115,6 +117,25 @@ namespace NetCoreConsoleClient
Console.WriteLine("1 - Create an Application Configuration.");
exitCode = ExitCode.ErrorCreateApplication;
CertificateIdentifier applicationCert;
if (Utils.IsRunningOnMono())
{
applicationCert = new CertificateIdentifier
{
StoreType = "Directory",
StorePath = "OPC Foundation/CertificateStores/MachineAccount",
SubjectName = "UA Core Sample Client"
};
}
else
{
applicationCert = new CertificateIdentifier
{
StoreType = "X509Store",
StorePath = "CurrentUser\\My",
SubjectName = "UA Core Sample Client"
};
}
Utils.SetTraceOutput(Utils.TraceOutput.DebugAndFile);
var config = new ApplicationConfiguration()
{
@@ -123,12 +144,7 @@ namespace NetCoreConsoleClient
ApplicationUri = "urn:" + Utils.GetHostName() + ":OPCFoundation:CoreSampleClient",
SecurityConfiguration = new SecurityConfiguration
{
ApplicationCertificate = new CertificateIdentifier
{
StoreType = "X509Store",
StorePath = "CurrentUser\\My",
SubjectName = "UA Core Sample Client"
},
ApplicationCertificate = applicationCert,
TrustedPeerCertificates = new CertificateTrustList
{
StoreType = "Directory",
@@ -207,7 +223,7 @@ namespace NetCoreConsoleClient
exitCode = ExitCode.ErrorCreateSession;
var endpointConfiguration = EndpointConfiguration.Create(config);
var endpoint = new ConfiguredEndpoint(null, selectedEndpoint, endpointConfiguration);
var session = await Session.Create(config, endpoint, false, ".Net Core OPC UA Console Client", 60000, new UserIdentity(new AnonymousIdentityToken()), null);
var session = await Session.Create(config, endpoint, false, "OPC UA Console Client", 60000, new UserIdentity(new AnonymousIdentityToken()), null);
Console.WriteLine("4 - Browse the OPC UA server namespace.");
exitCode = ExitCode.ErrorBrowseNamespace;