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.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- Subscribe items from windows services
Subscribe items from windows services
I know you mentioned DCOM configured, so are you connecting to a remote server?
If not, have you tried the same locally?
Have you tried the different settings for:
- EasyDAClient.ClientParameters.UseCustomSecurity
- EasyDAClient.ClientParameters.TurnOffActivationSecurity
- EasyDAClient.ClientParameters.TurnOffCallSecurity
Best regards
Please Log in or Create an account to join the conversation.
Both start a separated thread that subscribe the item so, theoretically there is no difference from the code side.
An example of the code:
in the subscribe thread, for each item into my DB:
...
ret = TheOPC.SubscribeItem(tag.Machine, tag.Server, tag.TAG, tag.UpdateRate, ITAG);
...
public static int SubscribeItem(string MachineName, string ServerClass, string ItemID, int UpdateRate, object state)
{
return MyEasyDAClient.SubscribeItem(MachineName, ServerClass, ItemID, UpdateRate, state);
}
....
MyEasyDAClient.ItemChanged += new EventHandler<EasyDAItemChangedEventArgs (MyEasyDAClient_ItemChanged);
...
private static void MyEasyDAClient_ItemChanged(object sender, EasyDAItemChangedEventArgs e)
{
if (RaiseItemRead != null && e != null)
{
if (e.Vtq != null)
{
RaiseItemRead(e.Vtq.Value, e.State);
}
else if (e.Exception != null)
{
InfoBaseClass.ShowInfo(e.Exception.Message);
}
}
}
...
The RaiseItemRead function write the value inside the DB.
THe parameters of the OPC Client are below but I've tested also with different values:
public class OPCParameters
{
public int MachineReconnectDelay = 1000;
public bool AllowAsynchronousMethod = true;
public bool AllowSynchronousMethod = false; //TASK_625
public bool Isolated = true;
public int ItemDetach = 5000;
public int ServerDetach = 30000; // ERA 30000
public int TopicRead = 5000; // ERA 120000
public int TopicWrite = 5000; // ERA 120000
internal DAReadWriteMethod IDesiredMethod = DAReadWriteMethod.Synchronous; //TASK_625
public int BrowseAccessPaths = 10000;
public int BrowseNodes = 25000;
public int BrowseProperties = 20000;
public int BrowseServers = 20000;
public int GetProperty = 3000;
public int ReadItem = 3000; // TASK_OPC
public int WriteItem = 10000;
public int ReadAutomatic = -1;
public int WriteAutomatic = -1;
public int DesiredMethod
{
get
{
return (int)IDesiredMethod;
}
set
{
IDesiredMethod = (DAReadWriteMethod) value;
}
}
}
Please Log in or Create an account to join the conversation.
Just to be sure, can you post a piece of code that handles the event, or relevant parts of it?
And, can you can confirm that the SAME code does work well from the Windows Forms app?
Please Log in or Create an account to join the conversation.
I've checked the logs of the server and seems that the tag has been correctly subscribed, the callback is sanded on value change but the data_change event is not raised.
Please Log in or Create an account to join the conversation.
Note: It is unlikely that the event is not fired at all. Isn't it coming, but with a non-null Exception property in the event argumens?
Please Log in or Create an account to join the conversation.
I want to subscribe a TAG value from opc server with a subscribe operation.
e.g.
EasyDAClient.SubscribeItem(MachineName, ServerClass, ItemID, UpdateRate, state);
I am able to do it through a windows form client without any issue.
But when I am trying to do the same from windows service, the change event is not fired.
I've already modified the DCOM configuration according to: xlreporter.net/download/OPC_and_DCOM.pdf but the issue is still there.
I've modified the user who run the service from system to local admin to domain admin... nothing change.
I'm working with EasyOPC v5.23 on a windows server 2008.
I'm trying to connect to a Keepware OPC server and to a Simatic OPC server.
The read-write operation without subscription works well.
Can you help me?
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- Subscribe items from windows services