ColdFusion lets you access and use Microsoft .NET assembly classes as CFML objects. CFML applications can use .NET assemblies in the following ways:

  • Directly access and control Microsoft products, such as Word, Excel, or PowerPoint.
  • Use existing .NET components.
  • Use .NET assemblies that you create to leverage features that are difficult to use or not available in ColdFusion or Java. (Because ColdFusion is a J2EE application, if you cannot code a feature in CFML, it is more efficient to create it in Java than to use .NET.)
    The .NET classes that your application uses do not have to be local; your ColdFusion application can access .NET components that are located on remote systems, even systems that are located outside your firewall. Also, the ColdFusion system does not require .NET run-time software installed to use remote .NET components, so ColdFusion running on a UNIX, Linux, Solaris, or OS-X system can access and use .NET assemblies.
    You can use the cfobject tag or CreateObject function to create a reference to a .NET class object, by specifying either .NET or dotnet as the object type. You use the reference to access the .NET class fields and call the .NET class methods. This technique provides a tightly coupled, stateful, efficient method for accessing .NET classes from ColdFusion. As an alternative, your .NET application can make the class methods available as web services; however, using a web service is less reliable, has lower performance, and is less scalable than using ColdFusion objects for the .NET classes.

Note:

.NET applications cannot access ColdFusion component functions directly. You can make the functions available as web services by specifying remote access. For more information on creating ColdFusion web services, see Using Web Services.

Because you use the .NET assembly classes the same way that you use any other ColdFusion object, you do not have to understand the details of .NET technology; you only have to understand how to use the specific .NET class that you are accessing. Code that uses a .NET method can be as simple as the following lines:

assembly = "C:/Net/Assemblies/math.dll">
<cfset myVar = mathInstance.multiply(1,2)>

ColdFusion .NET access has the following additional features:

  • If you make a change in the .NET assembly, ColdFusion automatically recognizes the change and uses that version for the next invocation.
  • Your application can access .NET assemblies running on multiple machines.
  • You can secure the communication between ColdFusion and .NET by using SSL.
  • Primitive data types are automatically mapped between ColdFusion and .NET data types.

How .NET access works

For ColdFusion to access .NET assemblies, ColdFusion .NET extension software must run on the system that hosts the assemblies. A ColdFusion system that accesses only remote assemblies does not require the .NET extension. The .NET extension software provides the .NET-side connectivity features that enable access to .NET assemblies, including a .NET-side agent (which normally runs as the ColdFusion .NET service) that listens for and handles requests from the ColdFusion system.
On the ColdFusion system, the ColdFusion objects use Java proxies that act as local representatives of the .NET classes. These proxies use binary TCP or SOAP-based HTTP communication to access a .NET-side agent. The agent then uses a DLL to invoke the .NET assembly classes. This communication is required in all cases, even if ColdFusion and the .NET assemblies are on the same system. 
The following image shows how CFML-to-.NET access works:

CFML to .NET access
CFML to .NET access

If your .NET assemblies are on the local system, ColdFusion automatically creates and manages all required proxies and configuration information. Ensure only that the .NET extension is installed on your system and that the ColdFusion .NET Service is running. You can use the cfobject tag or CreateObject function to access the assemblies without any additional steps. 
If the assemblies are on a remote system, you install and use the ColdFusion .NET extension software on the .NET system to create Java proxies for the .NET classes, and then move or copy them to the ColdFusion system. Also edit the JNBDotNetSide.exe.config file on the remote system to specify the .NET classes you use. The .NET system requires the following .NET extension software:

  • JNBDotNetSide.exe, the .NET-side agent that communicates with the ColdFusion system (normally run as the ColdFusion .NET service).
  • JNBDotNetSide.exe.config, a configuration file that identifies the .NET assemblies that ColdFusion can access.
  • jnbproxy.exe and jnbproxyGui.exe are command line and GUI-based programs that generate the Java proxies that represent the .NET assemblies.
  • Additional support files, including JNBShare.dll, which invoke the .NET assembly classes.
    For information on installing the ColdFusion .NET extension, see Installing ColdFusion guide.

Note:

When you install a new .NET version, reinstall the ColdFusion .NET extension.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy