Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

service

Hello Everyone,
 
I created a Windows Service Application (I'm using Visual Basic, Visual Studio 2008 ) and this application retrieves values ( every second )  from data sockets and sends these values to a database. That's all the application does.
 
The application works excellent.
 
The problem appears when I start a second application ( A GUI Windows application written in Visual Basic 2008 ) which retrieves values from the same data sockets ............................this application simply does not start when the Service is running ... If I want to start the GUI application, I have to shut down the service ..................So some sort of data collision happens here. .....
 
 
I would appreciate any reply and any hints. What could be the source of this problem ?
 
Best regards,
Seb
 
 
0 Kudos
Message 1 of 10
(5,549 Views)

Hello MadSeb,

Thank you for posting on the NI Discussion Forums.  What operating system are you running on?  When I run a Windows service application that accesses data from a data socket variable, I can launch a Windows Form Application that also reads from the same data socket just fine.  I am also using VB.NET and Visual Studio 2008, on a Windows XP machine. 

Just to clarify, are you saying that the Windows Form Application will not read from the shared variable, or that it will not even start?  If it does not even start, will a Windows Form Application that does not read from the data socket start?

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 2 of 10
(5,526 Views)

Just to clarify, are you saying that the Windows Form Application will not read from the shared variable, or that it will not even start? 

It will not even start....

If it does not even start, will a Windows Form Application that does not read from the data socket start?

Yes.

 

Btw, same issue is explained by my supervisor in this thread:  http://forums.ni.com/ni/board/message?board.id=232&thread.id=7299



Message Edited by MadSeb on 07-14-2008 09:17 AM
0 Kudos
Message 3 of 10
(5,504 Views)
 When I run a Windows service application that accesses data from a data socket variable, I can launch a Windows Form Application that also reads from the same data socket just fine.
 
Are you runnning the service as a LOCAL SERVICE, SYSTEM , NETWORK SERVICE OR USER ?
 
0 Kudos
Message 4 of 10
(5,497 Views)
MadSeb,
 
I am running a local service...Have you tried this?  Also, have you tried launching two Windows Form Applications that both access the same data socket?
Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 5 of 10
(5,474 Views)
Chris_G, Yes I tried running the service under different types of accounts ( Local
0 Kudos
Message 6 of 10
(5,472 Views)
Chris_G:
 
Yes , I did try running the service under different types of accounts ( Local Service, System, User , Network )  and no positive result ...............
 
Two Windows Form applications can read data simultaneously from the same OPC address....I tried it and it works....
 
 
 
 
 
 
 


Message Edited by MadSeb on 07-15-2008 01:56 PM
0 Kudos
Message 7 of 10
(5,472 Views)

MadSeb,

I am still not sure that there is some kind of “data collision” causing this issue.  Some more information is needed to determine the source of the issue.

 Do you have the development environment for Visual Studio on the machine that you are running into the issue with?  If so, launch the service application, and then launch the form application in debug mode to find out exactly where in your code the application is hanging.  I find it very peculiar that the UI will not even load, since it should not have to wait for any kind of connection for the OPC server to proceed.  This should help us determine if it is something in the code that is causing the hang.

It would also be helpful to check the code of the service application.  Since this cannot be run in debug mode, it would be useful to copy the bulk of the code into a form application, and then see if running it also halts other form applications that access the same variable from launching. 

As I mentioned before, I was able to launch a service application and a form application to successfully access the same variable.  The only difference was that I was using the National Instruments Data Socket Server, where as you are using the Industrial Automation OPC Server.  On that note, can you perform the tasks on the Data Socket Server instead to see if the behavior changes?  If your applications both need write access to the connection, you can follow these instructions to enable multiple writers.

Hopefully the results of one of these tests will lead us to some more concrete answers as to what is going on.

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 8 of 10
(5,430 Views)

 Do you have the development environment for Visual Studio on the machine that you are running into the issue with?  If so, launch the service application, and then launch the form application in debug mode to find out exactly where in your code the application is hanging.  I find it very peculiar that the UI will not even load, since it should not have to wait for any kind of connection for the OPC server to proceed.  This should help us determine if it is something in the code that is causing the hang.

 

I don't have the development environment for Visual Studio on the machine, but I already know that the Windows application gets stuck at the part where the Data Sockets are supposed to establish connections ( provided the Service is running in the background ) . When the service is not running, the Windows application works excellent.  
 
 

It would also be helpful to check the code of the service application.  Since this cannot be run in debug mode, it would be useful to copy the bulk of the code into a form application, and then see if running it also halts other form applications that access the same variable from launching

I tried this. Everything works fine when I convert the service into a form application.

 

 

 

 

 

 

 

 

 

0 Kudos
Message 9 of 10
(5,409 Views)

MadSeb,

Let's talk about this issue over email and update the forum once we've reached a solution.

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 10 of 10
(5,343 Views)