ColdFusion lets you access and use Microsoft .NET assembly classes as CFML objects. CFML applications can use .NET assemblies in the following ways:
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.
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:
<cfobject type = ".NET" name = "mathInstance" class = "mathClass" assembly = "C:/Net/Assemblies/math.dll"> <cfset myVar = mathInstance.multiply(1,2)>
ColdFusion .NET access has the following additional features:
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 8 .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:
If your .NET assemblies are on the local system, ColdFusion automatically creates and manages all required proxies and configuration information. You must ensure only that the .NET extension is installed on your system and that the ColdFusion 8 .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 8 .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. You must 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:
For information on installing the ColdFusion .NET extension, see Installing and Using ColdFusion.