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.

New Client Program Failing Over LAN

More
01 May 2014 15:07 #1917 by celder
Hmm. The problems could certainly be outside of the OPC code. I've had a difficult time tracking things down since the performance is so inconsistent.

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.

More
01 May 2014 11:54 #1913 by support
Thank you.

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.

More
29 Apr 2014 18:18 - 01 May 2014 11:55 #1909 by celder
The text from the Output window is always
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;
}
 
Last edit: 01 May 2014 11:55 by support. Reason: used [code] for better formatting

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

More
29 Apr 2014 07:29 #1905 by support
Thank you. What are the details of those first-chance exceptions please?

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.

More
28 Apr 2014 22:52 #1902 by celder
The first program may have received minor changes / been recompiled, but none of the OPC-related code has changed.

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.

More
27 Apr 2014 07:58 #1898 by support
That's truly weird - especially because the first program stooped working too. Is the first program completely untouched (same binary - .EXE), or hasn't it been recompiled or something? Any changes to .NET Framework or so, on the computer?

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.

More
25 Apr 2014 17:46 #1896 by celder
Thanks for the response.

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.

More
25 Apr 2014 05:28 #1888 by support
Hello,
can you please provide more details:
  1. Is the OPC server on the same computer as the client, or on a different computer?
  2. How was it in your previous application - server and client on the same computer, or on different computers?
  3. Are you getting this error always (i.e. you are unable to reads at all), or just sometimes?
  4. What precisely is in your COMPUTER_NAME?
  5. What precisely is in your OPC_SERVER_NAME?
  6. 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.

More
24 Apr 2014 23:01 #1887 by celder
I've made a small program in the past that uses OPC.NET to communicate with an OPC server.
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.

Moderators: support
Time to create page: 0.078 seconds