Professional OPC
Development Tools

logos

PHP ReadItem returns only "BadNonspecific" Quality

More
31 Mar 2016 16:49 #3971 by support
Thank you, I am glad it is working.

This is really a server-side DCOM issue; "Launching user" is an especially dangerous settings, because the server it is then started under the identity of the (potentially remote client process), which is hardly predictable or desired. Furthermore, when *multiple* clients with different identities attempt to connect to the server, DCOM will try to launch multiple copies of it, each under a different identity. What then happens depends on the server: Some may refuse to start the subsequent instances, some may start them but they would be somehow dysfunctional (returning errors or bad qualities), some may start but even the original instance would be negatively influenced...

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

More
31 Mar 2016 13:41 #3970 by alexf
Thank you, that was the trick to get it running.
The IIS is now running again as "ApplicationPoolIdentity" user.

If anyone else seeks a solution for this type of problem (Reminder for me):
I configured the DCOM object of the OPC server I used.
Right click on the DCOM object and select <properties>.
Go to the register <Identity>. On this page you have 4 different options
"The interactive user"
"The launching user"
"This user"
or "The system account (services only).

I selected "This user" and entered the login name and password of a user account.

Restarted the IIS, tried my test page and it is working.
Thank you

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

More
31 Mar 2016 08:05 #3968 by support
Please check (in DCOMCNFG) under which account the target OPC server is configured to run under. If it is "launching User" or "Interactive User", switch it to run under a specific account.
The following user(s) said Thank You: alexf

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

More
31 Mar 2016 07:30 #3967 by alexf
Hello!

This has definitley to do with the settings of the DCOM. As the Server on which the IIS is running is Windows Server 2012, it uses the "DefaultAppPool". In the Advanced settings dialog of this application pool, I temporarily switched the Identity to "LocalSystem".
Then the php script on the website is functioning.

But I do not consider this as good practice because of security so I will check how I can get the DefaultAppPool user to access the DCOM objects.

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

More
31 Mar 2016 06:13 - 31 Mar 2016 06:17 #3966 by alexf
Hello!

I am currently testing with the following code:

<html>
<head><t-itle>Test.php</title></head>
<body>
<?php

// Create EasyOPC-DA component
$Client = new COM("OpcLabs.EasyOpc.DataAccess.EasyDAClient");
print $Client->ReadItemValue("", "OPCLabs.KitServer.2", "Simulation.Random");

print "<br>";
$result = $Client->ReadItem("", "IBHSoftec.IBHOPC.DA.1", "G03S7.M1000.1");
print $result;
?>
</body>
</html>

The first line that reads the random value from the OPCLabsKit Server returns with the line
0,00125125888851588 {System.Double} @31.03.2016 06:11:00; Good GoodNonspecific LimitOk (GoodNonspecific)

The second line that reads from the connected PLC returns
@01.01.1601 00:00:00; Bad BadNonspecific LimitOk (BadNonspecific)

Reading the value from the command line with the following script:
<?php

$Client = new COM("OpcLabs.EasyOpc.DataAccess.EasyDAClient");

print $Client->ReadItem("", "IBHSoftec.IBHOPC.DA.1", "G03S7.M1000.1");
?>

returns:
False {System.Boolean} @31.03.2016 06:15:52; Good GoodNonspecific LimitOk (GoodNonspecific)
Last edit: 31 Mar 2016 06:17 by alexf.

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

More
31 Mar 2016 05:15 #3965 by support
Before we get deeper: Are you really receiving a VTQ where the Quality is BadNonSpecific, or are you not receiving any VTQ at all? Can you post the relevant piece of your code that process the results of ReadItem, with an indication at which place you are seeing the BadNonSpecific quality?

Thank you

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

More
30 Mar 2016 17:08 #3964 by alexf
Hello Community!

I have now a PHP website under IIS running. On some lines, I need to read and write values via OPC to the PLC.
After receiving a COM error - I had to enable the COM setting in the PHP.ini file, I tried to read values from the PLC and found out I had to configure the DCOM compontens.

After configuring the DCOM settings for OPCEnum and the used OPC server, I am trying to execute the ReadItem method with my settings for the OPC server. Through the website, i do not get any values and the Quality is indicated as "BadNonspecific".
I then tried to read the same variables via PHP script that was executed via the command line. I used the same commands and variables and there I get values with a good quality and the correct PLC variable value.

DCOM\Computer settings\Default Properties: "Enable distributed COM on this computer" is enabled.
Default Authentication Level: Connect
Default Impersonation Level: Identify

As for the DCOM configuration, I have set for the OPC Enum component and for "Opc Enum x64 Category Manager":
Authentication Level: "None"
Security and Activation Permissions --> Edit --> Group "Everyone" --> allow all permissions (local/remote launch, local/remote activation)
Access Permissions --> Edit --> Group "Everyone" Allow all permissions for "Local/Remote access"
For the used OPC DA Server, I configured the same settings at the DCOM components.

Reading via the website from the "OPCLabs.KitServer.2" --> e.g Simulation.Random is functioning. Have I missed a DCOM setting somewhere?
Firewall is set off
Thank you for your help

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

Moderators: support
Time to create page: 0.197 seconds

      

 Recommend this on Google