Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Intrinsic Component Configuration

More
26 Apr 2022 15:21 #10828 by tblong

Basically anything that has to do with QuickOPC objects should rather be avoided.


The above was the problem for me. I was adding an event handler for the client's LogEntry event as below just before setting up the config file:
EasyDAClient.LogEntry += OnEasyDAClientLogEntry;

Once put the config file init code first things began behaving as expected. Thanks much for the clues.
The following user(s) said Thank You: support

Please Log in or Create an account to join the conversation.

More
26 Apr 2022 14:47 #10827 by support
Hello,
it works for me. And, as far as I can tell, my code looks like your code. So, there must be some hidden difference.

I am attaching my full project.

File Attachment:

File Name: ConsoleApp1.zip
File Size:4 KB


Gotchas to look for:

1) Don't you have something in your code that would cause the static host be built earlier, before the code execution reaches the code you listed? Basically anything that has to do with QuickOPC objects should rather be avoided.

2) Is the .INI file actually alongside the EXE? This one got me too - I forgot to set "Copy to output directory" property on the INI file in the VS project originally.

Best regards
Attachments:

Please Log in or Create an account to join the conversation.

More
26 Apr 2022 12:07 #10826 by tblong
I had the below line where it was to watch the EnsureDataIntegrity property change from false (default) to true while debugging.
var secParams = ComManagement.Instance.Configuration.SecurityParameters;

I moved the above line to the bottom of the config init method, started a new debug session, and the EnsureDataIntegrity property still remains false as shown in the attached screenshot.
Attachments:

Please Log in or Create an account to join the conversation.

More
26 Apr 2022 06:14 #10824 by support
Hello,

I have not checked it thoroughly, but one thing already stands out: Why do you have this line
var secParams = ComManagement.Instance.Configuration.SecurityParameters;

at all, and, if you need it, why *before* configuring the "static host"?

This line causes first access to the security parameters, which will 1) initialize them to hard-coded default values, and then 2) overwrite them with the values from configurations set in the static host *at that point*. This will never be repeated then. So, the .INI file will not be considered.

Move this line after the static configuration.

Best regards

Please Log in or Create an account to join the conversation.

More
25 Apr 2022 20:09 #10823 by tblong
I'm using the latest v5.63.162 release and am attempting to add intrinsic config support for our application following these two resources and went the ".ini" provider route: Here is what my current ".ini" file is trying to set:
[OpcLabs.BaseLib.Runtime.InteropServices.ComManagement:Configuration:SecurityParameters]
EnsureDataIntegrity=True

And here is the initialization code to get it working:
private void ConfigProviderInit()
{
	var secParams = ComManagement.Instance.Configuration.SecurityParameters;
 
	StaticHost.GetHostBuilder().ConfigureAppConfiguration((hostingCx, configBuilder) =>
	{
		configBuilder.AddIniFile("Configuration-QuickOPC.ini", optional: true, reloadOnChange: false);
	});
 
	var result = ComManagement.Instance.AssureSecurityInitialization();
}

In case it helps, here is a log entry from my application after the config file init code above completes:
2022-04-25 15:18:06,566 INFO - OnEasyDAClientLogEntry: senderType="OpcLabs.EasyOpc.DataAccess.EasyDAClient" logEntryType="Information" message="Information(1): COM security initialization (process name "Console", Id 13172) for requestor '' succeeded; the initialization object was: (Default).
Made system call: yes, current thread name: "", from thread pool: no, apartment state: MTA."

When I run the final line of my init code above, the SecurityParameters.EnsureDataIntegrity property remains false (the default). I expected to see this property change to true instead. Would you mind checking to make sure I've not done something obviously wrong here? Thanks much for the guidance.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.051 seconds