Search code examples
c#wcfserviceopc

Windows Service does not support OpcRcw.Da.IOPCServer interface


I'am writing a program that reads data from and writes data to MySQL databases and OPC DA servers. I have developed de whole application in C# using several WCF services, and I have tested each function of each service, and they work fine.

I have programmed a console application which calls both services (MySQL and OPC DA) and it works. Then I have programmed a Windows Service with the same code, and the MySQL WCF service works the same (as expected), but the OPC WCF service doesn't, giving the following error when connecting to the OPC server:

*NotSupportedException: The COM server does not support the interface 'OpcRcw.Da.IOPCServer'.

This problema could be caused by:

  • incorrectly installed proxy/stubs.
  • problems with de DCOM security settings
  • a personal firewall*

None of these causes apply, since the OPC server and client (my application) run on the same machine. The service was initially configured to run as LocalSystem, but just in case it was due to user privileges, I also tried using the Domain Administrator. It didn't work either.

Connections between WCF services use TCP binding. I don't know what to look at right now, since both the console application and the service have the same code and run with high privileges.

Any idea is welcome! Thanks!


Solution

  • If your console app is running in 32 bit process and the service in 64-bit process or vice versa, the problem might be in the fact that the proxies/stubs are not installed for 32- or 64-bit bitness.