Using the Caché Gateway for .NET
Setting Gateway Server Properties
[Back] [Next]
Go to:

Properties of the ObjectGateway class specify the settings used by the Service class (see Running a Gateway Server) to access and monitor an instance of the .NET Gateway Server. This chapter covers the following topics:

Using the New Object Gateway Form
While it is possible to specify the settings for a .NET Gateway Server session entirely in ObjectScript code, it is usually simpler to use the New Object Gateway form to create and store a persistent %Net.Remote.ObjectGateway object. The following steps summarize the configuration procedure:
  1. In the Management Portal, go to [System Administration] > [Configuration] > [Connectivity] > [Object Gateways].
    The Object Gateways Page
    You can use the options on this page to view a Gateway's log of recent activity, start or stop a Gateway, and create, edit, or delete a Gateway Server definition.
  2. On the Object Gateways page, click Create New Gateway. The New Object Gateway form is displayed. Only the first three fields are required. The following example leaves the default values in place for all fields except Gateway Name, Port, and Log file (File path is set to the value that would be used if the field were left blank):
    The New Object Gateway Form
  3. Fill out the form and click Save. The following properties of ObjectGateway can be set:
  4. After saving the form, go back to the Object Gateways page. Your new .NET Gateway Server definition should now be listed there.
Defining Server Properties Programmatically
The ObjectGateway server properties can also be set programmatically.
In addition to the properties defined by the New Object Gateway form (as shown in the previous section), the Type property must also be set to "2". This defines the server as a .NET Gateway (as opposed to an Ensemble Java Gateway, which cannot be used in Caché).
The following example creates a server definition identical to the one generated by the New Object Gateway form described in the previous section:
 // Create the object and define it as a .NET Gateway
   set gw =  ##class(%Net.Remote.ObjectGateway).%New()
   set gw.Type = "2"   // a .NET Gateway, not an Ensemble Java Gateway

 // Set the properties
   set gw.Name  = "GatewayTwo"
   set gw.Server  = ""
   set gw.Port  = "55000"
   set gw.LogFile  = "C:\Temp\GatewayTwo.log"
   set gw.HeartbeatInterval  = "10"
   set gw.HeartbeatFailureTimeout  = "30"
   set gw.HeartbeatFailureAction  = "R"
   set gw.HeartbeatFailureRetry  = "300"
   set gw.InitializationTimeout  = "5"
   set gw.ConnectionTimeout  = "5"
   set gw.AllowedIPAddresses  = ""
   set gw.FilePath  = "C:\Intersystems\Cache\dev\dotnet\bin\v2.0.50727"
   set gw.DotNetVersion = "2.0"

 // Save the object
   set status = gw.%Save()
The call to %Save() is only necessary if you wish to add the object to persistent storage, making it available on the Object Gateways page of the Management Portal (as described in the previous section).
Gateway Server Versions
Different versions of the .NET Gateway Server assembly are provided for .NET 2.0 and 4.0. The following versions are shipped (where install-dir is the path that $SYSTEM.Util.InstallDirectory() returns on your system).
.NET Version 2.0:
.NET Version 4.0:
In some applications, these gateways may be used to load unmanaged code libraries. Since a 64-bit process can only load 64-bit DLLs and a 32-bit process can only load 32-bit DLLs, both 32-bit and 64-bit assemblies are provided for each supported version of .NET. This makes it possible to create gateway applications for 64-bit Windows that can load 32-bit libraries into the gateway.
The appropriate version of the .NET Framework must be installed on your system in order to use these assemblies. The Caché installation procedure does not install or upgrade any version of the .NET Framework.