I write a OPC client process in MFC, and everything is OK when I run it directly in VS2010. But when I install it as a windows services, problem comes. I still can connect to OPC Server, but after connected I check the status of the OPCServer with IOPCServer::GetStatus(), and it returns false! Is there something I need to watch out when I install the process as a windwos service?Or some settings of the OS need to set? (My OS is Win7)
0
votes
I don't get it. IOPCServer::GetStatus() is in your Server right ? It has nothing to do with the fact that there is a client connected no ? Which OPC Server are you using ?
– Camille G.
GetStatus() is a interface supported by OPCServer. Usually after the client connected to OPCServer, GetStatus will retunr true. I check this every 10 seconds. But when I insall the process as a windows service, GetStatus returns false and SyncRead will return 0x800706ba.I don't this it's the problem of OPCServer, because if I run the process directly in CMD, it works well.
– Nature
By looking a bit on the Internet I found that 0x8000706ba correspond to : "the RPC Server is unavailable". Some people figured it out but it seems more like a Win7 propblem rather than anything else.... try in a WinPrompt : netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=yes then : netsh advfirewall firewall set rule group="remote administration" new enable=yes
– Camille G.
It still doesn't work...The firewall is off on my computer.This problem has been bothering me for several days.Maybe I should write a batch file to run it as a ordinary process instead of trying to installing it as a windows service.
– Nature