opcfoundation / ua-.netstandard Goto Github PK
View Code? Open in Web Editor NEWOPC Unified Architecture .NET Standard
License: Other
OPC Unified Architecture .NET Standard
License: Other
Looks like you made a huge progress in the last commit. I made some tests on Ubuntu 2 weeks ago with the Marton's repository and I remember there were some trouble on this platform. It seems you fixed everything but I didn't test because I am on vacation.
It would be nice to have in the wiki something like tests results on the different OS supported by the .net core platform. Tests should include unit tests and OPC Foundation CTT test cases.
It is especially important for Core library. As far as today by design the library is collection of tightly coupled functionalities. Partially it is used in other application, e.g. UA-ModelCompiler, so it also needs decoupling.
To follow the separation of concern principle it seems that the following functionality shall be decoupled:
For some of them (e.g. protocols, tracing, configuration) Dependency Injection technique shall be considered.
When this library is used by the iot-gateway-opc-ua project, the client cannot connect to the C++ demo server from Unified Automation. The client selects endpoint with the highest security level, which uses policy Basic256Sha256, but open secure channel fails with BadInvalidArgument error message with reason [OpcUa Null String]. Can see by Wireshark that ClientNonce is null in the request, looks like that is the cause of the problem.
on MacOS (and likely other Linux flavors) DNS resolution fails.
Project NetCoreConsoleClient (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
.Net Core OPC UA Console Client sample
1 - Create an Application Configuration.
WARN: missing application certificate, using insecure connection.
2 - Discover endpoints of OPC UA server.
Could not fetch endpoints from url: opc.tcp://opc-server:51210/UA/SampleServer
Reason = One or more errors occurred. (This platform does not support connecting sockets to DNS endpoints via the instance Connect and ConnectAsync methods, due to the potential for a host name to map to multiple IP addresses and sockets becoming invalid for use after a failed connect attempt. Use the static ConnectAsync method, or provide to the instance methods the specific IPAddress desired.)
Exit due to Exception: One or more errors occurred. (One or more errors occurred. (This platform does not support connecting sockets to DNS endpoints via the instance Connect and ConnectAsync methods, due to the potential for a host name to map to multiple IP addresses and sockets becoming invalid for use after a failed connect attempt. Use the static ConnectAsync method, or provide to the instance methods the specific IPAddress desired.))
Backslashes in config files must be corrected for Linux, s.b.
Compiling NetCoreConsoleServer for .NETCoreApp,Version=v1.0
Compilation succeeded.
0 Warning(s)
0 Error(s)Time elapsed 00:00:02.0552053
Exit due to Exception: One or more errors occurred. (There is no cert with subject UA Sample Server in the configuration.
Copy cert to this location:
/Users/mregen/UA-.NETStandardLibrary/SampleApplications/Samples/NetCoreConsoleServer/OPC Foundation\CertificateStores\MachineDefault)
Hi Guys,
I followed the readme to configure the Web Telemetry applications. Looks like there is an exception when I push the Start button.
{"The Service Bus connection string is not of the expected format. Either there are unexpected properties within the string or the format is incorrect. Please check the string before trying again."}
The connection string in configuration.cs looks like
public static string EventHubConnectionString = "sb://ihsuprodamres002dednamespace.servicebus.windows.net;SharedAccessKeyName=iothubowner;8e/EjQ/aX5h6YFmdwWL1g0tiUb1I***petWEEnlQj+M=";
Just replaced some characters in the primary access key by stars to keep privacy of my access key.
Any idea what's wrong with my configuration?
Regards,
On Ubuntu 16.04 looks like the path in Opc.Ua.SampleServer.Config.xml is not used and the trace in created in /tmp/trace.log.
Testing with 1.0.0-preview2-003121
We need the Certificate Revocation List support for the GDS.
Linux client never returns from InternalValidate during Token renewal.
root cause: Extensive usage of Task.Run( async () etcetc).Wait()
blocks too many threads from the threadpool, eventually InternalValidate cannot return and deadlocks because there is no thread left in the threadpool.
Fix --> refactor use of Task.Run and other blocking Thread mechanism.
Just trying to connect the UWP SampleServer. Tested with uaexpert or another UA client (.NET) or node-opcua. Looks like the server does not return the endpoints. Also with the UA UWP client, thhe exception cannot fetch endpoint is triggered.
uaexpert:
Discovery GetEndpoints on opc.tcp://zion:51210/UA/SampleServer failed (BadTimeout)
Looks like i can't start the server from Visual Studio debug mode (same error out of visual studio).
Looks like the socket can't be opened because of a missing permission
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at Opc.Ua.Bindings.UaTcpChannelListener.Start()
The socketErrorCode is AccessDenied. DId i miss something in the configuration of the application?
Running Windows 10 Insider Preview 10.0.14342
Regards,
NetCoreConsoleClient crashes when updating it .Net core 1.1 and remove the certificates.
I´m buiding a OPC UA Client and use the possibility to connect without a certificate. it work fine util I updated my client to .net core 1.1. Now the method below crashes.
public static X509Certificate2 Create(byte[] encodedData, bool useCache)
{
}
Steps to reproduce.
Update the project.json to .net core 1.1 in NetCoreConsoleClient
Delete CertificateStores
update code to not use CertificateStores
bool haveAppCertificate = false;// config.SecurityConfiguration.ApplicationCertificate.Certificate != null;
/* if (!haveAppCertificate)
{
Console.WriteLine(" INFO: Creating new application certificate: {0}", config.ApplicationName);
X509Certificate2 certificate = CertificateFactory.CreateCertificate(
config.SecurityConfiguration.ApplicationCertificate.StoreType,
config.SecurityConfiguration.ApplicationCertificate.StorePath,
config.ApplicationUri,
config.ApplicationName
);
config.SecurityConfiguration.ApplicationCertificate.Certificate = certificate;
}
haveAppCertificate = config.SecurityConfiguration.ApplicationCertificate.Certificate != null;
*/
Different behaviour on Windows and Linux: FileSystemInfo.LastWriteTimeUtc throws exception if the folder doesn't exist.
Workaround create an empty folder UA Applications/private beside certs, otherwise own cert cannot be copied to trusted store, which may cause some strange certificate validation errors.
06:41:08.828 Checking application instance certificate.
06:41:08.832 Checking application instance certificate. CN=Opc.Ua.TestStation, DC=mregen-ubuntu16
06:41:09.057 Checking domains in certificate. CN=Opc.Ua.TestStation, DC=mregen-ubuntu16
06:41:09.068 Adding certificate to trusted peer store. StorePath=../OPC Foundation/CertificateStores/UA Applications
06:41:09.108 Could not add certificate to trusted peer store. StorePath=../OPC Foundation/CertificateStores/UA Applications FileNotFoundException 'Could not find file '/home/martin/azure-iot-stuttgart/Simulation/Factory/OPC Foundation/CertificateStores/UA Applications/private'.'========================================
Id: Bad
Description: Could not find file '/home/martin/azure-iot-stuttgart/Simulation/Factory/OPC Foundation/CertificateStores/UA Applications/private'.
Could not find file '/home/martin/azure-iot-stuttgart/Simulation/Factory/OPC Foundation/CertificateStores/UA Applications/private'.
--- at System.IO.FileSystemInfo.EnsureStatInitialized()
--- at System.IO.FileSystemInfo.System.IO.IFileSystemObject.get_LastWriteTime()
--- at System.IO.FileSystemInfo.get_LastWriteTimeUtc()
--- at Opc.Ua.DirectoryCertificateStore.Load(String thumbprint) in /home/martin/UA-.NetStandardLibrary/Stack/Opc.Ua.Core/Security/Certificates/DirectoryCertificateStore.cs:line 726
--- at Opc.Ua.DirectoryCertificateStore.Enumerate() in /home/martin/UA-.NetStandardLibrary/Stack/Opc.Ua.Core/Security/Certificates/DirectoryCertificateStore.cs:line 109
--- at Opc.Ua.Configuration.ApplicationInstance.d__58.MoveNext() in /home/martin/UA-.NetStandardLibrary/SampleApplications/SDK/Opc.Ua.Configuration/ApplicationInstance.cs:line 1486========================================
fresh enlistment, create the certs, start the app: the certs are in a read only folder. But certs should be in a writable folder
Adding certificate to trusted peer store. StorePath=C:\Users\xxx\Source\Repos\UA-.NETStandardLibrary\SampleApplications\Samples\Publisher\bin\x64\Debug\AppX\OPC Foundation\CertificateStores\UA Applications
Exception thrown: 'System.UnauthorizedAccessException' in System.IO.FileSystem.dll
After decoupling of selected functionality UT shall be added at least to Core library/libraries.
Press the "Publish" button and the application will start publishing the nodes JSON encoded data (Note: the JSON format is not compliant to the upcoming OPC Foundation PubSub specification) to your IoTHub.
The ReadMe says the publish example doesn't follow the OPC UA Pub/Sub specification. Where can I find the specification for Pub/Sub implementation on a protocol such as AMQP?
Hi!
Please I would like to know if there are plans to support Windows Nano Server. If I understand correctly Nano Server supports CoreCLR but not UWP.
As a bonus, CoreCLR support would allow to run the same code in Linux/Mac OS.
Thank you very much for the attention!
Good day,
had a problem running createcert.sh in UA-.NETStandardLibrary\SampleApplications\Samples\NetCoreConsoleClient\ in Ubuntu 14.04
Needed to run :
sed` -i -e 's/\r$//' createcert.sh
Best,
Mikhail
Hello everyone , My IDE is VS2015 update 3 , win 7 and win10SDK 10586, but I open this Project and rebuild it ,in Opc.Ua.Client.Control(Universal Windows),
error code :
The type 'IAsyncAction' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
The type 'IAsyncActionWithProgress<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
The type 'IAsyncOperation<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.
The type 'IAsyncOperationWithProgress<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'
How to solve this question? thank you very much!!!
dotnet is brand new for Linux, few steps to get started would help to avoid some pitfalls.
Now that there is an OPC UA implementation targeting the Standard library we wanted to write a mobile client implementation using the Xamarin platform.
When trying to connect a OPC UA server we get the following exception
Specified argument was out of the range of valid values.
--- at System.ServiceModel.Channels.BufferManager+DefaultBufferManager.TakeBuffer (Int32 bufferSize) [0x0001f] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/BufferManager.cs:174
--- at Opc.Ua.Bindings.BufferManager.TakeBuffer (Int32 size, System.String owner) [0x0002c] in XXX\Repos\UA-.NETStandardLibrary\Stack\Opc.Ua.Core\Stack\Bindings\BufferManager.cs:162
--- at Opc.Ua.Bindings.TcpMessageSocket.ReadNextMessage () [0x00022] in XXX\Repos\UA-.NETStandardLibrary\Stack\Opc.Ua.Core\Stack\Tcp\TcpMessageSocket.cs:348
--- at Opc.Ua.Bindings.TcpClientChannel.OnConnectComplete (System.Object sender, System.Net.Sockets.SocketAsyncEventArgs e) [0x00076] in XXX\Repos\UA-.NETStandardLibrary\Stack\Opc.Ua.Core\Stack\Tcp\TcpClientChannel.cs:747
The exception is thrown from the TakeBuffer
method of the DefaultBufferManager
class of the Mono framework.
public override byte [] TakeBuffer (int bufferSize)
{
if (bufferSize < 0 || (max_size >= 0 && bufferSize > max_size))
throw new ArgumentOutOfRangeException ();
int l2 = log2 ((uint) bufferSize);
if (l2 > log_min)
l2 -= log_min;
List<byte []> returned = buffers [l2];
if (returned == null || returned.Count == 0)
return new byte [bufferSize];
foreach (var e in returned){
if (e.Length >= bufferSize){
hits++;
returned.Remove (e);
return e;
}
}
return new byte [bufferSize];
}
After some further analysis we found that BufferManager
implementations of the Mono framework and the .NET framework differ. While Mono implementation tests against the configured max_size
value and throws an exception there is no such control in the .NET framework code.
public byte[] TakeBuffer(int size, string owner)
{
if (size > Int32.MaxValue - 5)
{
throw new ArgumentOutOfRangeException("size");
}
lock (m_lock)
{
#if TRACK_MEMORY
byte[] buffer = m_manager.TakeBuffer(size+5);
byte[] bytes = BitConverter.GetBytes(++m_id);
Array.Copy(bytes, 0, buffer, buffer.Length-5, bytes.Length);
buffer[buffer.Length-1] = 0;
m_allocated += buffer.Length;
Allocation allocation = new Allocation();
allocation.Id = m_id;
allocation.Buffer = buffer;
allocation.Timestamp = DateTime.UtcNow;
allocation.Owner = owner;
m_allocations[m_id] = allocation;
return buffer;
#else
byte[] buffer = m_manager.TakeBuffer(size+1);
buffer[buffer.Length-1] = 0;
return buffer;
#endif
}
}
So the obvious question is how are we calling TakeBuffer
with a buffer size bigger than the configured maximum size. The answer to this question lies in the BufferManager class of the stack. This class internally uses the built in BufferManager
implementations of the underlying framework but on TakeBuffer
method adds some more to the expected buffer size.
One of the many places this method is called is inside the ReadNextMessage
method of the TcpMessageSocket class. This class sends the internal m_receiveBufferSize
field to the TakeBuffer
method. But examining where this field's value comes leads us to the TcpClientChannel class.
Socket = new TcpMessageSocket(this, BufferManager, Quotas.MaxBufferSize);
As can be seen the value sent to the TakeBuffer
is already the maximum buffer size and the BufferManager
class is adding some more and expecting more than the maximum configured buffer size.
Are we missing something here?
Thanks in advance
Only Repros on .Net 4.6 Client, doesn't happen on UWP Client. Needs Investigation.
19:42:42.648 TCPSERVERCHANNEL SOCKET ATTACHED: 028F1359, ChannelId=1
19:42:42.694 Channel 0: SendHelloMessage()
19:42:42.694 TakeBuffer(10D5FB2,10000,SendHelloMessage)
19:42:42.694 Channel 2 in Connecting state.
19:42:42.710 TCPSERVERCHANNEL SOCKET ATTACHED: 014A4F1C, ChannelId=2
19:42:42.804 TakeBuffer(2308F08,10000,ProcessHelloMessage)
19:42:42.819 Channel 1 in Opening state.
19:42:42.898 Channel 0: ProcessAcknowledgeMessage()
19:42:42.898 Channel 0 in Opening state.
19:42:43.054 Security Policy: http://opcfoundation.org/UA/SecurityPolicy#None
19:42:43.069 Sender Certificate: (none)
19:42:43.085 SECURE CHANNEL CREATED [TcpServerChannel UA-TCP 1.02.335.0] [ID=1] Connected To: opc.tcp://erichb02:61210/UA/SampleClient [None/None/Binary]
19:42:43.085 Channel 1 in Open state.
19:42:43.085 Channel 1: SendOpenSecureChannelResponse()
19:42:43.241 Channel 0: ProcessOpenSecureChannelResponse()
19:42:43.257 Security Policy: http://opcfoundation.org/UA/SecurityPolicy#None
19:42:43.273 Sender Certificate: (none)
19:42:43.273 SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 1.02.335.0] [ID=1] Connected To: opc.tcp://localhost:61210/UA/SampleClient [None/None/Binary]
19:42:43.288 Channel 1 in Open state.
19:42:43.366 Channel 1: ProcessRequestMessage 1
19:42:43.382 TakeBuffer(556DB3,10000,ReadNextMessage)
19:42:43.382 LockBuffer(556DB3,10000)
19:42:43.398 Channel 1: SendResponse 1
19:42:43.444 Channel 1: Close
19:42:43.460 Channel 1 in Closing state.
19:42:43.476 Channel 1: SendCloseSecureChannelRequest()
19:42:43.491 UnlockBuffer(556DB3,10000)
19:42:43.538 LockBuffer(556DB3,10000)
19:42:43.569 UnlockBuffer(556DB3,10000)
19:42:43.585 ReturnBuffer(556DB3,10000,ProcessCloseSecureChannelRequest)
19:42:43.585 TCPSERVERCHANNEL ProcessCloseSecureChannelRequest Socket=028F1359, ChannelId=1, TokenId=1
19:42:43.585 Channel 1 in Closed state.
19:42:43.632 Channel 1 closed
19:42:43.632 ReturnBuffer(556DB3,10000,OnMessageReceived)
Exception thrown: 'System.InvalidOperationException' in Opc.Ua.Core.dll
Additional information: Buffer has been locked.
Hi,
TCP 5671 port is not open in our company network and does anybody know how to configure Opc.Ua.Publisher.config.xml to allow it run through port 443, thanks in advance.
Please add Opc.Ua.ConfigurationTool.exe and related functionality back in, as it was in .NET implementation by OPC Foundation
Since the Windows cert store had to go (not cross platform), we Need a secure replacement. TPM is the obvious choice, but we Need a cross platform, .Net Standard-compatible TPM library for that. Looking at TSS right now (https://www.microsoft.com/en-us/download/details.aspx?id=52507).
The connection string format provided in the code did not work for me:
public static string EventHubConnectionString = "{EventHubEndpoint};SharedAccessKeyName=iothubowner;{PrimaryKey}";
What worked for me is the modified version:
public static string EventHubConnectionString = "Endpoint={EventHubEndpoint};SharedAccessKeyName=iothubowner;SharedAccessKey={PrimaryKey}";
Hi,
I am trying to create an UWP sample server application using OPCFoundation.NetStandard.Opc.Ua.Core
and OPCFoundation.NetStandard.Opc.Ua.SDK
nugget packages. Yet there is no Opc.Ua.Client.Controls.dll
in OPCFoundation.NetStandard.Opc.Ua.Core
. Is there any reason not having it included?
Thanks!
Stephen
12:11:08.801 Channel 0 in Connecting state.
Exception thrown: 'Opc.Ua.ServiceResultException' in Opc.Ua.Core.dll
Additional information: BadNotConnected
Hello, I would like to know if this OPC library is able to run as UWP application. I am trying to make the project UWP but because not all libraries are available as in full .NET framework (cryptography) then it does not work.
Thank you
Running the standard server. Access Objects/Data/Static/Array/VariantValue. Session hosed due to exception.
System.ArgumentNullException occurred
HResult=-2147467261
Message=String reference not set to an instance of a String.
Parameter name: s
ParamName=s
Source=System.Private.CoreLib
StackTrace:
at System.Text.Encoding.GetBytes(String s)
at Opc.Ua.BinaryEncoder.WriteXmlElement(String fieldName, XmlElement value) in UA-.NETStandardLibrary\Stack\Opc.Ua.Core\Types\Encoders\BinaryEncoder.cs:line 493
InnerException:
[External Code]
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.WriteXmlElement(string fieldName, System.Xml.XmlElement value) Line 493 C#
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.WriteXmlElementArray(string fieldName, System.Collections.Generic.IList<System.Xml.XmlElement> values) Line 1438 C#
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.WriteVariant(string fieldName, Opc.Ua.Variant value) Line 838 C#
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.WriteDataValue(string fieldName, Opc.Ua.DataValue value) Line 953 C#
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.WriteDataValueArray(string fieldName, System.Collections.Generic.IList<Opc.Ua.DataValue> values) Line 1582 C#
Opc.Ua.Core.dll!Opc.Ua.ReadResponse.Encode(Opc.Ua.IEncoder encoder) Line 32494 C#
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.WriteEncodeable(string fieldName, Opc.Ua.IEncodeable value, System.Type systemType) Line 1122 C#
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.EncodeMessage(Opc.Ua.IEncodeable message) Line 231 C#
Opc.Ua.Core.dll!Opc.Ua.BinaryEncoder.EncodeMessage(Opc.Ua.IEncodeable message, System.IO.Stream stream, Opc.Ua.ServiceMessageContext context) Line 209 C#
Opc.Ua.Core.dll!Opc.Ua.Bindings.TcpChannel.WriteSymmetricMessage(uint messageType, uint requestId, Opc.Ua.Bindings.TcpChannelToken token, object messageBody, bool isRequest, out bool limitsExceeded) Line 221 C#
Opc.Ua.Core.dll!Opc.Ua.Bindings.TcpServerChannel.SendResponse(uint requestId, Opc.Ua.IServiceResponse response) Line 184 C#
Opc.Ua.Core.dll!Opc.Ua.Bindings.UaTcpChannelListener.OnProcessRequestComplete(System.IAsyncResult result) Line 398 C#
Opc.Ua.Core.dll!Opc.Ua.AsyncResultBase.OperationCompleted() Line 271 C#
Opc.Ua.Core.dll!Opc.Ua.EndpointBase.ProcessRequestAsyncResult.OnProcessRequest(object state) Line 876 C#
Opc.Ua.Core.dll!Opc.Ua.EndpointBase.ProcessRequestAsyncResult.CallSynchronously() Line 682 C#
Opc.Ua.Core.dll!Opc.Ua.ServerBase.ProcessRequest(Opc.Ua.IEndpointIncomingRequest request) Line 1381 C#
Opc.Ua.Core.dll!Opc.Ua.ServerBase.RequestQueue.ScheduleIncomingRequest.AnonymousMethod__0() Line 1442 C#
Hello,
I solved my probem that the OnLaunced() Method in the project OPC.Ua.SampleServer breaks on Raspherry Pi 3.Instead of using the async implementation of OnLauned i override the sync implementation.
///
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
///
/// Details about the launch request and process.
protected override /async/ void OnLaunched(LaunchActivatedEventArgs args)
{
.......
// load the application configuration.
Task.Run(async () => { await application.LoadApplicationConfiguration(false); }).Wait();
// check the application certificate.
Task.Run(async () => { await application.CheckApplicationInstanceCertificate(false, 0); }).Wait();
// start the server.
Task.Run(async () => { await application.Start(new Opc.Ua.Sample.SampleServer()); }).Wait();
......
Task.Run(async () => { await dialog.ShowAsync(); }).Wait();
.......
}
call
dotnet run NetCoreConsoleClient opc.tcp://[2003:63:2e19:4100:6d23:5fc8:48c5:9ff5]:51210/UA/SampleServer
21:40:49.428 SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 1.02.335.0] [ID=31] Connected To: opc.tcp://[2003:63:2e19:4100:6d23:5fc8:48c5:9ff5]:51210/UA/SampleServer [None/None/Binary]
21:40:49.437 Channel 31 in Open state.
21:40:49.469 GetEndpoints Completed. RequestHandle=1, PendingRequestCount=0
Exception thrown: 'System.UriFormatException' in System.Private.Uri.dll
Exception thrown: 'System.UriFormatException' in System.Private.Uri.dll
Exception thrown: 'System.UriFormatException' in System.Private.Uri.dll
Exception thrown: 'System.UriFormatException' in System.Private.Uri.dll
Exception thrown: 'System.UriFormatException' in System.Private.Uri.dllOpc.Ua.Core.dll!Opc.Ua.ConfiguredEndpoint.GetDiscoveryUrl(System.Uri endpointUrl) Line 1194 C#
Opc.Ua.Core.dll!Opc.Ua.ConfiguredEndpoint.UpdateFromServer(System.Uri endpointUrl, Opc.Ua.MessageSecurityMode securityMode, string securityPolicyUri) Line 1032 C#
Opc.Ua.Core.dll!Opc.Ua.ConfiguredEndpoint.UpdateFromServer() Line 1020 C#
Opc.Ua.Client.dll!Opc.Ua.Client.Session.Create(Opc.Ua.ApplicationConfiguration configuration, Opc.Ua.ConfiguredEndpoint endpoint, bool updateBeforeConnect, bool checkDomain, string sessionName, uint sessionTimeout, Opc.Ua.IUserIdentity identity, System.Collections.Generic.IList preferredLocales) Line 754 C#
Opc.Ua.Client.dll!Opc.Ua.Client.Session.Create(Opc.Ua.ApplicationConfiguration configuration, Opc.Ua.ConfiguredEndpoint endpoint, bool updateBeforeConnect, string sessionName, uint sessionTimeout, Opc.Ua.IUserIdentity identity, System.Collections.Generic.IList preferredLocales) Line 711 C#
NetCoreConsoleClient.dll!NetCoreConsoleClient.Program.ConsoleSampleClient(string endpointURL) Line 103 C#
NetCoreConsoleClient.dll!NetCoreConsoleClient.Program.Main(string[] args) Line 38 C#
Connect NetCoreConsoleClient to NetCoreConsoleServer running both on Ubuntu 16.04:
After a few minutes the server bails out. No repro on windows.
Unhandled Exception: System.InvalidOperationException: Buffer has been locked.
at Opc.Ua.Bindings.BufferManager.ReturnBuffer(Byte[] buffer, String owner)
at Opc.Ua.Bindings.BufferCollection.Release(BufferManager bufferManager, String owner)
at Opc.Ua.Bindings.TcpChannel.HandleWriteComplete(BufferCollection buffers, Object state, Int32 bytesWritten, ServiceResult result)
at Opc.Ua.Bindings.TcpChannel.OnWriteComplete(Object sender, SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
at System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.CompletionCallback(Int32 bytesTransferred, SocketError socketError)
at System.Net.Sockets.SocketAsyncEventArgs.TransferCompletionCallback(Int32 bytesTransferred, Byte[] socketAddress, Int32 socketAddressSize, SocketFlags receivedFlags, SocketError socketError)
at System.Net.Sockets.SocketAsyncContext.<>c.b__50_0(Object args)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Hi,
Please replace the below step:
Get from OPC Misc Tool the Certificate generator tool. (build the solution and get the Opc.Ua.CerticateGenerator.exe)
instead add the step:
Go to https://opcfoundation.org/developer-tools/developer-kits-unified-architecture/sample-applications/ and download and install version 1.02.336.0. The Opc.Ua.CertificateGenerator.exe will be installed on the machine.
Thanks
morning sir ,
I read , but I still don't know how OpcUaWebTelemetry works.
Dont know {StorageAccountName}{AccessKey}{ConsumerGroupName} those parameter how to configure in Azure ...
Can someone demonstrate how OpcUaWebTelemetry connect Azure and OpcUA client/server use youtube or PDF(use picture)?
then @me , thank you very much!!!
Best Regards!
Connecting to an OPC UA Server through an Android App developed using Xamarin.form is not successful .
In Session.Connect, it throws an exception, connection refused...
Trace with TRACE_MEMORY defined:
19:42:42.585 Channel 0 in Connecting state.
19:42:42.632 TakeBuffer(21AF1A5,10000,ReadNextMessage)
19:42:42.632 Channel 1 in Connecting state.
19:42:42.648 TCPSERVERCHANNEL SOCKET ATTACHED: 028F1359, ChannelId=1
19:42:42.663 TakeBuffer(253E9CE,10000,ReadNextMessage)
19:42:42.648 LockBuffer(21AF1A5,10000)
19:42:42.663 LockBuffer(253E9CE,10000)
19:42:42.694 Channel 0: SendHelloMessage()
19:42:42.694 TakeBuffer(10D5FB2,10000,SendHelloMessage)
19:42:42.694 Channel 2 in Connecting state.
19:42:42.710 TCPSERVERCHANNEL SOCKET ATTACHED: 014A4F1C, ChannelId=2
19:42:42.741 TakeBuffer(2308F08,10000,ReadNextMessage)
19:42:42.741 LockBuffer(2308F08,10000)
19:42:42.710 UnlockBuffer(253E9CE,10000)
19:42:42.773 LockBuffer(253E9CE,10000)
19:42:42.741 UnlockBuffer(2308F08,10000)
19:42:42.773 UnlockBuffer(253E9CE,10000)
19:42:42.804 ReturnBuffer(2308F08,10000,DoReadComplete)
19:42:42.804 TakeBuffer(2308F08,10000,ProcessHelloMessage)
19:42:42.819 Channel 1 in Opening state.
19:42:42.819 UnlockBuffer(21AF1A5,10000)
19:42:42.851 LockBuffer(21AF1A5,10000)
19:42:42.819 ReturnBuffer(253E9CE,10000,OnMessageReceived)
19:42:42.882 TakeBuffer(253E9CE,10000,ReadNextMessage)
19:42:42.882 LockBuffer(253E9CE,10000)
19:42:42.851 UnlockBuffer(21AF1A5,10000)
19:42:42.898 Channel 0: ProcessAcknowledgeMessage()
19:42:42.898 Channel 0 in Opening state.
19:42:42.913 TakeBuffer(3D8C971,10000,WriteAsymmetricMessage)
19:42:42.929 TakeBuffer(D1713E,10000,Encrypt)
19:42:42.929 ReturnBuffer(3D8C971,10000,WriteAsymmetricMessage)
19:42:42.929 UnlockBuffer(253E9CE,10000)
19:42:42.976 LockBuffer(253E9CE,10000)
19:42:42.929 ReturnBuffer(21AF1A5,10000,OnMessageReceived)
19:42:43.007 TakeBuffer(3D8C971,10000,ReadNextMessage)
19:42:43.007 ReturnBuffer(D1713E,10000,WriteOperation)
19:42:42.976 UnlockBuffer(253E9CE,10000)
19:42:43.007 LockBuffer(3D8C971,10000)
19:42:43.054 TakeBuffer(34E5D84,10000,Decrypt)
19:42:43.054 Security Policy: http://opcfoundation.org/UA/SecurityPolicy#None
19:42:43.069 Sender Certificate: (none)
19:42:43.085 SECURE CHANNEL CREATED [TcpServerChannel UA-TCP 1.02.335.0] [ID=1] Connected To: opc.tcp://erichb02:61210/UA/SampleClient [None/None/Binary]
19:42:43.085 Channel 1 in Open state.
19:42:43.085 Channel 1: SendOpenSecureChannelResponse()
19:42:43.101 TakeBuffer(2E5BEBB,10000,WriteAsymmetricMessage)
19:42:43.101 TakeBuffer(556DB3,10000,Encrypt)
19:42:43.116 ReturnBuffer(2E5BEBB,10000,WriteAsymmetricMessage)
19:42:43.116 UnlockBuffer(3D8C971,10000)
19:42:43.148 LockBuffer(3D8C971,10000)
19:42:43.116 ReturnBuffer(34E5D84,10000,ProcessOpenSecureChannelRequest)
19:42:43.179 ReturnBuffer(253E9CE,10000,OnMessageReceived)
19:42:43.179 TakeBuffer(2E5BEBB,10000,ReadNextMessage)
19:42:43.148 UnlockBuffer(3D8C971,10000)
19:42:43.210 ReturnBuffer(556DB3,10000,WriteOperation)
19:42:43.210 LockBuffer(2E5BEBB,10000)
19:42:43.241 Channel 0: ProcessOpenSecureChannelResponse()
19:42:43.257 TakeBuffer(D1713E,10000,Decrypt)
19:42:43.257 Security Policy: http://opcfoundation.org/UA/SecurityPolicy#None
19:42:43.273 Sender Certificate: (none)
19:42:43.273 SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 1.02.335.0] [ID=1] Connected To: opc.tcp://localhost:61210/UA/SampleClient [None/None/Binary]
19:42:43.288 Channel 1 in Open state.
19:42:43.288 ReturnBuffer(D1713E,10000,ProcessOpenSecureChannelResponse)
19:42:43.288 ReturnBuffer(3D8C971,10000,OnMessageReceived)
19:42:43.304 TakeBuffer(D1713E,10000,ReadNextMessage)
19:42:43.304 LockBuffer(D1713E,10000)
19:42:43.304 TakeBuffer(1400C58,10000,ArraySegmentStream.Write)
19:42:43.319 TransferBuffer(1400C58,10000,WriteSymmetricMessage)
19:42:43.319 UnlockBuffer(2E5BEBB,10000)
19:42:43.351 LockBuffer(2E5BEBB,10000)
19:42:43.351 UnlockBuffer(2E5BEBB,10000)
19:42:43.319 ReturnBuffer(1400C58,10000,WriteOperation)
19:42:43.366 Channel 1: ProcessRequestMessage 1
19:42:43.382 ReturnBuffer(2E5BEBB,10000,ProcessRequestMessage)
19:42:43.382 TakeBuffer(556DB3,10000,ReadNextMessage)
19:42:43.382 LockBuffer(556DB3,10000)
19:42:43.398 Channel 1: SendResponse 1
19:42:43.398 TakeBuffer(2428E43,10000,ArraySegmentStream.Write)
19:42:43.398 TransferBuffer(2428E43,10000,WriteSymmetricMessage)
19:42:43.413 ReturnBuffer(2428E43,10000,WriteOperation)
19:42:43.413 UnlockBuffer(D1713E,10000)
19:42:43.429 LockBuffer(D1713E,10000)
19:42:43.429 UnlockBuffer(D1713E,10000)
19:42:43.444 ReturnBuffer(D1713E,10000,ProcessResponseMessage)
19:42:43.444 TakeBuffer(1400C58,10000,ReadNextMessage)
19:42:43.444 LockBuffer(1400C58,10000)
19:42:43.444 Channel 1: Close
19:42:43.460 Channel 1 in Closing state.
19:42:43.476 Channel 1: SendCloseSecureChannelRequest()
19:42:43.476 TakeBuffer(3D893C,10000,ArraySegmentStream.Write)
19:42:43.476 TransferBuffer(3D893C,10000,WriteSymmetricMessage)
19:42:43.491 UnlockBuffer(556DB3,10000)
19:42:43.491 ReturnBuffer(3D893C,10000,WriteOperation)
19:42:43.538 LockBuffer(556DB3,10000)
19:42:43.569 UnlockBuffer(556DB3,10000)
19:42:43.585 ReturnBuffer(556DB3,10000,ProcessCloseSecureChannelRequest)
19:42:43.585 TCPSERVERCHANNEL ProcessCloseSecureChannelRequest Socket=028F1359, ChannelId=1, TokenId=1
19:42:43.585 UnlockBuffer(1400C58,10000)
19:42:43.616 ReturnBuffer(1400C58,10000,DoReadComplete)
19:42:43.585 Channel 1 in Closed state.
19:42:43.632 Channel 1 closed
19:42:43.632 ReturnBuffer(556DB3,10000,OnMessageReceived)
Exception thrown: 'System.InvalidOperationException' in Opc.Ua.Core.dll
Additional information: Buffer has been locked.
I was following the tutorial to create the telemetry example, but ran into problems with the following step: Now run the OPC UA Publisher sample, connect to a OPC UA server and publish a node.
There is no OPC UA Publisher sample in this repository! Has it been deleted or am I missing something here? Should I use the NetCoreConsolePublisher ?
I want to set up a sample to understand the OPC UA and IOT Hub connection, any recommendation on how to continue?
Hi,
I followed README and everthing goes well, but got trouble of below step, "•Press the "Publish" button and the application will start publishing the node's Pub/Sub encoded data to your IoTHub". Because i cannot find any "Publish" button.
Appreciate your help here, thanks in advance.
When trying to run the NetCoreConsoleServer in an Azure Webjob the app crashes with error code
0xC0000374 (HEAP_CORRUPTION).
The problem seems related to the X509Certificate. By default the system use a local directory of users to store the key, but Azure Website has no local user profile directory
One error is solved Changing the X509KeyStorageFlags.DefaultKeySet parameter to X509KeyStorageFlags.MachineKeySet in
DirectoryCertificateStore.cs in
certificate = new X509Certificate2(
privateKeyFile.FullName,
(password == null) ? String.Empty : password,
X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);
But the same error (0xC0000374) is postponed to the following line in ApplicationInstance.cs, (in the method CheckApplicationInstanceCertificate):
certificate = await CreateApplicationInstanceCertificate(configuration, minimumKeySize, 600);
I am getting the following error when I try to run the example projects:
(…) There is no cert with subject UA Sample Client in the configuration.
Copy cert to this location: (...) \OPC Foundation\CertificateStores\MachineDefault
Any hint how to create the certificates for the client and the server would be great. Is it the same procedure as described here “Trusting Applications built with UA .NET API”.
Thanks.
Michael
When I running the server sample in Windows 10, occurred this message:
There is no cert with subject UA Sample Server in the configuration.
Copy cert to this location:
C:\Users[user]\AppData\Local\Packages[packageName]\LocalState\OPC Foundation\CertificateStores\MachineDefault
Althought I copied the .cert file which I generated with subject name: UA Sample Server.
Can we add an Issue/PR template to the repository to standardize how stuff is reported?
Like this: https://github.com/blog/2111-issue-and-pull-request-templates.
Here is an example from another project: https://github.com/fsprojects/ProjectScaffold/blob/master/.github/ISSUE_TEMPLATE.md
There is an issue with the certificate generated with createcert.sh on Ubuntu 16.04 while the certifcate generated by OPC CertificateGenerator (generated on windows and copied to the linux host) is fine and accepted by the server. Find below the trace file.
10:07:35.940 Loading application configuration file. /home/eric/lab/opc_f/UA-.NE
TStandardLibrary/SampleApplications/Samples/NetCoreConsoleServer/Opc.Ua.SampleSe
rver.Config.xml
10:07:36.377 Could not load private key for certificate UA Sample Server OpenSsl
CryptographicException 'error:23076071:PKCS12 routines:PKCS12_parse:mac verify f
ailure'
10:07:36.387 Could not load private key certificate from file: arizona.pfx OpenS
slCryptographicException 'error:23076071:PKCS12 routines:PKCS12_parse:mac verify
failure'
10:07:36.396 Checking application instance certificate.
10:07:36.397 Could not load private key certificate from file: arizona.pfx OpenS
slCryptographicException 'error:23076071:PKCS12 routines:PKCS12_parse:mac verify
failure'
10:07:36.400 Could not load private key certificate from file: arizona.pfx OpenS
slCryptographicException 'error:23076071:PKCS12 routines:PKCS12_parse:mac verify
failure'
10:07:36.403 ServiceResultException:One or more errors occurred. (Cannot access
certificate private key. Subject=CN=UA Sample Server, DC=arizona)
Hallo, could you please help me with following task?
I am trying to find out how to add nodes to the server on server side. Looking in to the code I find out that perhaps there are some functionality in CoreNodeManager class. In this class I noticed that some parts of code is disabled by missing definition of LEGACY_CORENODEMANAGER. Is this correct direction I am looking?
Dear friends,
I would like to know if it is possible to create Android clients that connect to OPC UA server.
I tried to port the Client sample to my Android project but the references in the project points to libraries like Windows forms that are not needed/available for Android.
Another problem is that the connection to OPC UA server is made using some xml configuration files not exactly clear, is there a way to do it via code as in Android it would be more easy to do that way?
I searched through the internet but not found any Wiki or docs related to UA-.NETStandardLibrary, can any one please help?
HSB
When both NetCoreConsole client and server applications run on same machine, the certificate check in the CreateSession() method in StandardServer.cs fails at this check:
if (!String.IsNullOrEmpty(certificateApplicationUri) && !String.IsNullOrEmpty(clientDescription.ApplicationUri) && certificateApplicationUri != clientDescription.ApplicationUri)
The certificateApplicationUri string contains "urn:MyPCName:OPCFoundation:SampleClient" and the clientDescription.ApplicationUri string contains "urn:localhost:OPCFoundation:SampleClient", and thus the string comparison fails.
SubjectName and ApplicationName must be equal or client certs are sometimes not accepted from servers. usually it works with fresh certs, but on later use the server may return error codes like BadSecurityCheck failed.
<ApplicationName>UA Core Sample Server</ApplicationName>
<!-- Where the application instance certificate is stored (MachineDefault) -->
<ApplicationCertificate>
<StoreType>Directory</StoreType>
<StorePath>OPC Foundation/CertificateStores/MachineDefault</StorePath>
<SubjectName>UA Core Sample Server</SubjectName>
</ApplicationCertificate>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.