Software solutions for automation connectivity










DCOM (Distributed COM) for OPC

The ability of OPC clients and servers to remotely interconnect - i.e have the OPC client application running on one computer and the OPC server on another - is quite powerful and is the enabler for many interesting applications. However, therein lies a hidden issue - Distributed COM, or as it is more commonly known - DCOM. DCOM is often one of the stumbling blocks for new OPC users. So new users should take note that there are some important details to be concerned with when setting up a system for remote OPC connections. Be aware that it may be necessary to enlist the services of a network administrator, in order to safely and effectively set up the required configurations.

Most OPC servers include detailed instructions for setting up DCOM, because each DCOM configuration is potentially slightly different, therefore we chose not to include definitive information on DCOM in our OPC client documentation. As a general note, you would be wise to disable any firewalls for testing purposes - that is often the source of problems. It is also a good idea once your DCOM security settings have been set and you are successfully reasing and writing OPC data remotely, to confirm the integrity of your network and PCs from a security standpoint.

Note: Much of this article is written from the perspective of the Visual Basic programmer, but applies equally to users of all languages and development environments.

DCOM Configuration on OPC Server PC

First of all, refer to your OPC server documentation, or contact your vendor for information about setting DCOM security for your particular OPC server. The information below is intended for general reference and should not be taken as 100% accurate in all cases. No responsibility is taken for the application or misapplication of the information presented.

The following settings will enable Windows NT or Windows 2000 to communicate with an NT or Windows client and back (assuming that there are no firewalls or proxy servers involved).

To configure your OPC Server on an NT or Windows 2000 machine, follow the steps given below. Note that DCOMCNFG will only show servers that are EXEs. It will not show DLL servers. In the case of DLL servers, carefully consult the OPC server documentation.

  1. Go to the Windows task bar -> Start -> Run… then type in DCOMCNFG.EXE to launch the DCOM configurator.

  2. From the Applications tab, select the DCOM Server application (which will be represented by its ProgID - a friendly name, such as "DataLayers.OPC.Server.1") or by its CLSID (a GUID - Globally Unique Identifier) such as {5BD7512F-3F2B-11D0-B4D2-02E0C911A7B1}).

  3. Double-click the Server application or click the Properties button to view the properties of the server application.

  4. Select the Security Tab.

  5. Make the following changes:

    IMPORTANT: The following changes will allow anyone at all to launch the server. These settings are just for getting the servers up and running in development mode for debugging purposes. They are not intended for specific DCOM security on a target platform distribution.
    	Everyone    -allow access
    	System      -allow access
    	Interactive -allow access
    	Everyone    -allow launch
    	System      -allow launch
    	Interactive -allow launch
  6. Select the Identity Tab, and then select "The Interactive User."

  7. Click OK, and then click OK again.

Since your OPC server is raising events to your clients and using client callbacks, then you will also need to make the following changes to the default settings for your NT or Windows 2000 'Server' machine:

On the NT or Windows 2000 SERVER machine:

  1. Using DCOMCNFG.EXE, select the Default Properties Tab.

  2. Set the Default Authentication Level to "None."

  3. Set the Default Impersonation Level to "Identify."

NOTE: Make sure you test your DCOM application where the client and the server are running under different user accounts.

If your application works at this point, then you should not need to make any configuration settings on the client machines.

To configure your OPC Clients:-

On the NT or Windows CLIENT machines:

  1. Using DCOMCNFG, select the Default Properties Tab.

  2. Set the Default Authentication Level to "None."

  3. Set the Default Impersonation Level to "Impersonate."

On the WIN95 CLIENT machines:

  1. Using DCOMCNFG.EXE, select the Default Security Tab.

  2. Click Edit Default.

  3. Grant Access to "The World" user.

NOTE: Modifying and setting security settings should be done with caution and awareness. Before modifying security settings, be sure that you understand the security implications involved. The above client settings are only necessary in certain network situations and can be added via setup code to the clients registry. For more information about writing such code see the references in the Further Information section later in this article.

DCOM Configuration on OPC Client PC

OPC Clients such as OPCWare Client Developer can use remote events callbacks to enable two-way communication between OPC clients and an OPC server application. If you are using OPCWare Client Developer with a OPC server on a remote PC it is essential to configure DCOM settings on the client PC as well as the server PC.

Due to the use of callbacks, it is necessary to change DCOM settings on the client PC. This can sometimes be done programmatically, and many OPC client applications take this approach. Alternatively it is possible to change the system default DCOM configuration on the client PC, or to create and/or change an entry in the registry for your OPC client application DCOM settings.

In some cases, without making any registry or DCOM settings on the client PC, you may find that other OPC clients can connect to remote OPC servers but your own applications which you created using OPCWare Client Developer cannot connect at all, and you see some DCOM related error messages being generated. This is usually the case with Visual Basic applications, as such applications cannot set their DCOM attributes programatically at runtime. Therefore it is necessary to either change the system default DCOM configuration on the client PC, or to create and/or change an entry in the registry for your particular OPC client application DCOM settings. When the application is restarted, the new DCOM settings take effect and connection should be possible.

To save you the trouble of using DCOMCNFG.EXE or REGEDIT.EXE on your client PCs, we have created a special utility to help configure DCOM for your OPC client application. You can download the OPC Client DCOM configuration utility [here].

The DCOM settings for the Visual Basic development environment itself can also be adjusted with this utility, so you can work on remote OPC servers at design time and in debug mode within Visual Basic.

For more information regarding using remote events or callbacks with DCOM and OPC, please see the following article in the Microsoft Knowledge Base:
Q175510 : FILE: VB5DCOM.EXE: Using Callbacks and WithEvents with DCOM

Further Information

There are many useful articles and sources of DCOM information available on the web, we are not going to repeat it all here. If you need to find out more, below we list some of the best sources of information.

Back to Top

Note: Some or all of the terms Microsoft, Windows, Visual Basic, ActiveX, OPC may be trademarks of their respective owners.

Copyright © Data Layers Limited 2005. All rights reserved.
Comments or problems relating to this site? Please notify our webmaster

See what OPCWare Client Developer, the leading OPC Client development tool, can do for you...

OPCWare Client Developer v2.0.11 [info]

Testimonials [more]

June 2004 – "I do think that your software is the quickest, easiest, and most flexible of the ones that I have looked at. Also the support that I have received thus far on just evaluating your product has been great." - Scott, Systems Engineer, Machine Builder/OEM, USA.

Read what others are saying, view more testimonials here.[more]

Get in touch with a sales representative today.[email]

See what you think yourself, and download your free fully functional evaluation copy right now. [download]

Click Here to visit the OPCWare Online Shop Now

Pricing | Buy Now

What is OPC?

Data Layers is a member of the OPC Foundation

Order | Download | Products

Home | About | Contact