Author Topic: Using AdvancedHMI Drivers in a Windows Service v3.97  (Read 3287 times)

Controlsnut

  • Newbie
  • *
  • Posts: 15
    • View Profile
Using AdvancedHMI Drivers in a Windows Service v3.97
« on: January 10, 2015, 01:14:17 PM »
Since updating to v3.97 and visual studio 2013. I am having an issue where everytime I try to write to the PLC I'm getting:

System.Windows.Forms; Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

Since this is a windows service I am not using any forms in my code...I know it's stemming from the AdvancedHMI Driver references because I had a recent issue where a window was popping up says Incomplete Solution.

I was under the assumption that error was corrected when I added all of the AdvancedHMI projects to my solution. Now since installing on the production machine (and I'm actually connected to PLC's) I'm getting a similar error about the WindowsForms in my log, yet when I step through the code in debug mode (user interactive mode) everything writes to the PLC without issue.

I'm out of ideas here. Archie please is there anything you can think of here...

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #1 on: January 10, 2015, 02:37:53 PM »
I have uncovered a couple issues with version 3.97. I am not sure if these are related to what you are seeing, but a new version will be posted tomorrow evening. I would say try that version then we can go from there if you still have the issue.

All of the testing of AdvancedHMI is only done using an application with a UI, so I'm not sure how they will perform in a service. There may be some references somewhere that is possibly trying to show a message box.

Controlsnut

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #2 on: January 10, 2015, 02:47:58 PM »
Okay thanks Archie...I'll let you know how it works. Up unto this point I haven't had any issues running in a service. I guess the question isn't so much about the messagebox, it's what's causing the messagebox to be thrown. Windows services are historically very difficult to troubleshoot, but I do know it is not a database connectivity issue I have on the otherside, it is definitely stemming from AdvancedHMI drivers when trying to do a write to the PLC.

How you manage to stay on top of this stuff and answer everyone's request so quickly is beyond me, but keep up the good work. I will provide some feedback on your update when I can.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #3 on: January 10, 2015, 03:52:51 PM »
In the EthernetIPforCLXCom.vb code, there are several instances of this code:

System.Windows.Forms.MessageBox.Show

That code will definitely give the mentioned error. You can try to comment out those likes.

Controlsnut

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #4 on: January 15, 2015, 09:14:51 PM »
Hi Archie,
Just recompiled to 3.97c...no change. Something is different and I'm not sure what??? I've migrated to VS2013 and that's when it seems the issues arose, but can't say if that is related. Like I said I am running it as a service and have had no issues up until now (other than some of the fixes you've been working through), but this one has me stumped. When I step through the code line by line it does what it is supposed to. When I deploy it (using Installshield LE) on the production this is where I get that modal dialog...any ideas.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #5 on: January 15, 2015, 09:42:41 PM »
You can go to the Properties of the AdvancedHMIDrivers project and remove the reference to System.Windows.Forms, then go to each error and see if you can comment out that line of code.

Controlsnut

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #6 on: January 15, 2015, 10:14:13 PM »
Hi Archie, far too many references...I will surely break something. The bigger question is what is causing the form to fire. Like I said if I step through in debug mode everything appears to work the way it should even though I'm not connected to a plc (I get an exception which gets logged...but no form firing). It's something else and I have no idea what it is because I can't recreate on my development computer. This is only occurring when deploying.

phuz

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #7 on: January 20, 2016, 07:27:04 PM »
I also just ran into this.  I am using the InstallShield to deploy it, and it installs fine on the remote computer, but when I try to launch it, I get "Incomplete Solution" although it tests fine in the Visual Studio IDE.


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Using AdvancedHMI Drivers in a Windows Service v3.97
« Reply #8 on: January 20, 2016, 08:01:13 PM »
What all files do you have with your executable after install?