2
votes

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!

1
Probably it is related to the credentials that the windows service running with. Try using user credentials instead of built-in credentials like network etc. - Eldar
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. - ZbynekZ
@ZbynekZ, that was the problem. I reviewed the compilation options of all the projects and change them to 32 bits and Any CPU and it worked properly. Thank you for your help!! If you want to send it as an answer, I'll check the message as the solution. - Jordi

1 Answers

0
votes

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.