4

I am a .Net developer. New to OPC. When I tried some samples of OPC Client all of them give this error. It seems the DLL is not registered it seems. But I don't know how and where to register this.

error: retrieving the COM class factory for component with CLSID failed due to the following error: 80040154

Even I tried this

regsvr32 Interop.OPCAutomation.dll", 

but it also throws error like

The module "Interop.OPCAutomation.dll" was loaded but the entry-point DllRegisterServeer was not found.
Make sure that "Interop.OPCAutomation.dll" is a valid DLL or OCX file and then try again.

I have gone through so many existing forums. So many of them said to change the Platform Target to x86 and still I am having the same issue. FYI, I can see only see 'Active (Any CPU)' in the Platform option from the top of the Build tab of Project Properties.

Here are my environment details:

.Net 2005
OPCAutomation Weapper
Windows 7 64-bit OS
Dell Inspiron 1525 (I hope this is not a 64bit machine, but my engineer installed 64bit OS somehow).

Please help me.

Thanks in advance!

Abu Sithik
  • 287
  • 1
  • 5
  • 18
  • are you sure that the dll that you are trying to register is a OCX if it is or if it's an UnManaged COM DLL try regsrv32 if not then all you should need to do is add a reference to that .dll.. if that doesn't work then recompile the project and set your .x86 to x64 – MethodMan Feb 20 '12 at 19:29
  • @DJKRAZE Thanks for your time with me. I'm not sure about the dll that it is a OCX, but it is a common one everyone using. I have downloaded a sample project which includes this DLL file. Also tried the regsrv32, the above mentioned error came. I already added a reference to the DLL and checked, no difference. Finally as you said I set my target to x64 and tried, no improvement. – Abu Sithik Feb 20 '12 at 19:48
  • What is the OS you have..is it 32bit or 64bit..? also what about the GAC has the Interop.OPCAutomation.dll been added to the GAC..? – MethodMan Feb 20 '12 at 19:50
  • My OS is 64-bit. I have no idea about GAC. sorry and pls help. – Abu Sithik Feb 20 '12 at 19:57
  • there is a GAC utility that you can use to register / add the dll to the Global Assembly Cache.. do a google search for GAC.. – MethodMan Feb 20 '12 at 20:12
  • Hi @DJKRAZE When I try to add the "Interop.OPCAutomation.dll" to assembly it says this error: "Failure adding assembly to the cache: Attempt to install an assembly without a strong name" – Abu Sithik Feb 21 '12 at 16:10

6 Answers6

5

Just in case somebody is dealing with this problem (as I've recently been...) I get through it! After some time, I found out that it's something about the .NET framework running on 64-bit machines. As long as the.NET application works only with 32-bit CLR, we must set .NET framework to load CLR in WOW mode. To do so, type:

C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe SetWow

After this you should be able to run the applications.

You can go back and revert .NET Framework as it was before by typing:

C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe Set64
j0k
  • 22,600
  • 28
  • 79
  • 90
guiu
  • 51
  • 1
  • 2
1

If the OPC Client Toolkit SDK (C++) is used, a problem with the remote registry service may cause this error as well.

On Windows 7, by default the Remote Registry service is set to manual and not started. Ensure that the Remote Registry service is started on all of the machines you want to deploy to. This can be done manually or using Group Policy.

The function GetCLSIDFromRemoteRegistry() uses the RemoteRegistryService in order to get the CLSID of an OPC Server. If this service is not started on the client machine, the OPC program may return the error 80040154.

0

This question is a bit dated so I hope you figured it out by now, but I had the same exact issue and wanted to share my solution. In my case, I am using a Kepware server. If you compile and try to run a client application for this server using Interop.OPCAutomation on a machine that does not have the server installed, you will get a dll not registered error and "entry point not found" if you try to register the dll manually.

Solution: Make sure you've got the server installed and running.

Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
0

Although this is an old post, I would like to share my solution.

My problem was that when I tried to install an application with the OPCAutomation.dll, it gave me 80040154 error because the class was not registered.

This is my solution, always with Administrator privileges:

  1. Copy OPCDAAuto.dll into the "C:\Windows\System32" folder
  2. On the cmd prompt type "C:\Windows\System32\regsvr32 opcdaauto.dll"
  3. You should watch a message like this one: image

Hope this helps!

0

The OPC dll only works in 32 Bits, my solution was to change the "Enable 32-Bit Applications" to True in the advanced settings of the relative app pool in IIS.

App Pool

Advanced definition of APP pool in IIS

Adrian
  • 655
  • 6
  • 10
0

The error you're getting is more than likely due to the OPC server not being properly registered. Make sure it is registered (usually by running it at the command line with a "/regserver" or "/service" parameter). There may also be security issues in which case you'd have to run 'dcomcnfg' (DCOM Config) to make sure the client has access to the server.

Ken
  • 427
  • 4
  • 20
  • He thinks the wrapper is the server. You might want to expand on that. – Hans Passant Feb 20 '12 at 20:23
  • I have gone through the DCOM Config. I can see so many components of the system. Is there any specific component I should check permission for OPC Server? – Abu Sithik Feb 20 '12 at 20:24