I'm having a problem with testing a VB.NET program I'm using to programmatically change the DCOM launch / activation and access permissions for an OPC Server application (application is Kepware V5). I've made a test program based on the following:
I'm having no issue with the code and my test application is successfully adding a user (NewTestUser) to the DCOM 'Launch and Activation permissions' and the 'Access permissions' for the Kepware application. I verify this by checking the 'Launch and Activation permissions' and the 'Access permissions' for the Kepware application in the Windows 'Component Services' DCOM configuration tool shown here:
However when I reboot the machine and I try to connect a local OPC client to the OPC server application (Kepware V5). I get the following messge in the event log:
The application-specific access security descriptor for the COM Server application C:\Program Files (x86)\Kepware\KEPServerEX 5\server_runtime.exe with APPID {B3AF0BF6-4C0C-4804-A122-6F3B160F4397} is invalid. It contains Access Control Entries with permissions that are invalid. The requested action was therefore not performed. This security permission can be corrected using the Component Services administrative tool.
I get the above message despite the fact that I can see all the users (including the newly added user) in the 'Component Services' screen for the application without any sign of anything being wrong.
I can resolve this by changing any one of the NewTestUser values for the settings in the DCOM 'launch and activation permissions' and the 'access permissions' for the Kepware application. Basically by changing any one of the values and saving the change and then changing the value back to its original value this gets the local OPC comms to work (after reboot). So it seems that the act of changing the settings (and changing back again) from 'Component Services' resolves the issue. Being forced to do this defeats the purpose of my program.
Perhaps saving the settings from 'Component Services' is saving a change somewhere else in the registry besides what is shown on the screen?
I'm stuck on this so if anyone has any idea any help would be appreciated.
