- Posts: 7
- Thank you received: 0
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
- Connections, Reconnections, COM/DCOM
- New Client Program Failing Over LAN
New Client Program Failing Over LAN
Can you suggest any debug steps for my problem, assuming that it is outside QuickOPC?
I had to catch SEHException at some point because I wasn't disposing of the thread early enough. It's not needed now, I suspect. I haven't got around to trimming it out yet.
I can't remember why there's a NullReferenceException catch there. I'm inclined to think I was debugging some issue and left it there too.
Please Log in or Create an account to join the conversation.
As it turns out, the first-chance exceptions in the Output window are actually those that you later catch. The one with (0xC004C001 is for "Cannot connect Data Access client (timeout).", and the one with 0x800706BA is for "The RPC server is unavailable". In this sense, there is nothing new (it would be suspicious if something got thrown but was "swallowed" somehow, and that's what I wanted to rule out).
To me the most likely reason for these errors appears to be outside our component. These are the kinds of things (especially the RPC error) that we cannot influence from inside, even if we wanted to.
I have reviewed your code and do not see anything wrong it too. I just find it interesting that you felt it was needed to catch NullReferenceException and SEHException. Are you getting them sometimes (you shouldn't....).
Please Log in or Create an account to join the conversation.
A first chance exception of type 'OpcLabs.EasyOpc.OpcException' occurred in OpcLabs.EasyOpcClassic.dll
The details are:
Additional information: An OPC operation failure with error code -1073430527 (0xC004C001) occurred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inner exception contains details about the problem.
I also get these details:
Additional information: An OPC operation failure with error code -2147023174 (0x800706BA) occurred, originating from 'OpcLabs.EasyOpcRaw.DataAccess.RawEasyDAClient'. The inner exception contains details about the problem.
Exceptions with the first set of details happen a lot of times first, then I get a lot of the second type.
EDIT:
Most of these are probably thrown by a thread that's constantly trying to write a value; about 20 times per second.
A lot of these exceptions happen before my breakpoint in the catch statement is hit.
Here's the whole Write method that's throwing the exceptions.
private CError WritePLCItem(string item_id, object value)
{
CError error = new CError();
try
{
client.WriteItemValue(CRollCommon.OPC_COMPUTER_NAME, CRollCommon.OPC_SERVER_NAME, item_id, value);
connectionGood = true;
return error;
}
catch (OpcLabs.EasyOpc.OpcException e)
{
connectionGood = false;
switch (e.ErrorCode)
{
case CRollCommon.OPC_ERROR_TIMEOUT:
error = new CError(CRetMsg.RET_ERROR, "PLC write failed due to timeout.");
break;
default:
error = new CError(CRetMsg.RET_ERROR, "Failed to write PLC item.");
break;
}
}
catch (NullReferenceException)
{
error = new CError(CRetMsg.RET_ERROR, "PLC write failed due to null reference.");
}
catch (System.Runtime.InteropServices.SEHException)
{
error = new CError(CRetMsg.RET_ERROR, "PLC write failed due to external component. Could be OPC connection not terminating correctly.");
}
catch (Exception e)
{
error = new CError(CRetMsg.RET_ERROR, "PLC write failed unexpectedly.", e);
}
connectionGood = false;
return error;
}
Please Log in or Create an account to join the conversation.
Can you please provide the text from the Output windows, plus set the options to break into the debugger when the exception is thrown (not just when it is unhandled), and when it is thrown, capture the exception details?
Thank you
Please Log in or Create an account to join the conversation.
It's a desktop application.
Both programs now are sometimes working, sometimes not. They seem to both work / not work at the same times.
I tried the async disable code, but it doesn't seem to have any effect.
Also, I've just realized that in the Output window of Visual Studio I'm getting a lot of first-chance exceptions from EasyOpcClassic.dll.
Please Log in or Create an account to join the conversation.
What kind of project is your program - a desktop app, or some kind of Web app/ Web service? (thinking of the accounts it runs under etc.).
The first timeout is also weird. Maybe the async callbacks (used to notify the client of "read complete") are not making their way back to the client? Can you please try this to force sync operations instead:
easyDAClient = new EasyDAClient();
easyDAClient.ClientMode.AllowAsynchronousMethod = false;
easyDAClient.ClientMode.AllowSynchronousMethod = true;
easyDAClient.ClientMode.DesiredMethod = DAReadWriteMethod.Synchronous;
Thank you
Please Log in or Create an account to join the conversation.
The OPC server is on a different computer. The previous application was the same.
I'm always unable to read, and always unable to write with my new program. Generally, the first read request times out, and the second throws the error.
COMPUTER_NAME is either "ATBVISION05" (the name of the computer), or "192.168.1.195" (its local IP).
Switching between these two values makes no difference to operation of the program, as far as I can tell.
OPC_SERVER_NAME is "PhoenixContact.AX-Server.21".
I can successfully use OPC Expert to read/write/subscribe tags. I have not tried other OPC clients, but I had the first program working. I have set up DCOM in the past.
That being said, the first program now does not work remotely either.
If I run the first program on the machine with the server, then it does work.
Please Log in or Create an account to join the conversation.
can you please provide more details:
- Is the OPC server on the same computer as the client, or on a different computer?
- How was it in your previous application - server and client on the same computer, or on different computers?
- Are you getting this error always (i.e. you are unable to reads at all), or just sometimes?
- What precisely is in your COMPUTER_NAME?
- What precisely is in your OPC_SERVER_NAME?
- Have you tried some other OPC client, from the same machine, to connect to the server, and if so, what were the results?
Thank you
Please Log in or Create an account to join the conversation.
I didn't have any problems there.
However, I'm making a new application, using essentially the same code, and I'm getting an "RPC server is not available" exception.
I'm using VS2012, and C# with WinForms.
My code looks like this:
EasyDAClient client = new EasyDAClient();
retVal = client.ReadItemValue(COMPUTER_NAME, OPC_SERVER_NAME, item_id);
What can I try to make this work?
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Connections, Reconnections, COM/DCOM
- New Client Program Failing Over LAN