Skip to main content

Setting Gateway Server Properties

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 — The simplest way to define a set of server properties is to use the New Object Gateway form in the Management Portal, which allows you to create and store a predefined ObjectGateway object.

  • Defining Server Properties Programmatically — It is also possible to set the properties of a ObjectGateway object at runtime.

  • Gateway Server Versions — Different versions of the .NET Gateway Server executable are provided for .NET 2.0, 4.0, and 4.5, and for 32-bit and 64-bit systems.

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.ObjectGatewayOpens in a new tab 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
    generated description: smp gatelist

    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
    generated description: smp newgateway
  3. Fill out the form and click Save. The following properties of ObjectGateway can be set:

    • NameRequired. A name that you assign to this .NET Gateway definition.

    • ServerRequired. IP address or name of the machine where the .NET Gateway server executable is located. The default is "".

    • PortRequired. TCP port number for communication between the .NET Gateway server and the proxy classes in Caché. Several methods of class Service (see “Running a Gateway Server”) accept the port number as an optional parameter with a default value of 55000.

    • PassPhrase — If this property is checked, the Gateway will require a passphrase to connect.

    • LogFile — Full pathname of the file used to log .NET Gateway messages. These messages include acknowledgment of opening and closing connections to the server, and any difficulties encountered in mapping .NET classes to Caché proxy classes. This optional property should only be used when debugging.

    • AllowedIPAddresses — IP address of the local network adapter to which the server listens. Specify (the default) to listen on all IP adapters on the machine (including, VPNs, and others) rather than just one adapter. You may not enter more than one address; you must either specify one local IP address, or listen on all of them. You must provide a value for this argument if you define the LogFile property.

    • FilePath — Specifies the full path of the directory where the .NET Gateway server executable is located. This is used to find the target executable and assemble the command to start the .NET Gateway on a local server, and is required only when you want to use an executable that is not in the default location. If you do not specify this setting, the form will use the appropriate default executable for your system and your specified .NET Version.

    • Exec64 — (applies only to .NET Gateways on 64-bit platforms) If this property is checked, the Object Gateway server will be executed as 64-bit. Defaults to 32-bit execution.

    • DotNetVersion — Specifies the .NET version (2.0, 4.0, or 4.5) to be used (see “Gateway Server Versions”). Defaults to .NET 2.0.

    • Advanced settings (hidden by default)

      • HeartbeatInterval — Number of seconds between each communication with the .NET Gateway to check whether it is active. A value of 0 disables this feature. When enabled, valid values are from 1 to 3600 seconds (1 hour). The default is 10 seconds.

      • HeartbeatFailureTimeout — Number of seconds to wait for a heartbeat response before deciding that the .NET Gateway is in failure state. If this value is smaller than the HeartbeatInterval property, the Gateway is in failure state every time the .NET Gateway communication check fails. The maximum value is 86400 seconds (1 day). The default is 30 seconds.

      • HeartbeatFailureAction — Action to take if the .NET Gateway goes into a failure state. Valid values are "R" (Restart) or "N"(None). The default action is Restart, which causes the .NET Gateway to restart.

      • HeartbeatFailureRetry — Number of seconds to wait before retrying the HeartbeatFailureAction if the .NET Gateway server goes into failure state, and stays in failure state. A value of 0 disables this feature, meaning that once there is a failure that cannot be immediately recovered, there are no attempts at automatic recovery. Valid values when enabled are from 1 to 86400 (24 hours). The default is 300 seconds (5 minutes).

      • InitializationTimeout — Number of seconds to wait for a response during initialization of the Gateway server. Valid values are from 2 to 300 (5 minutes). The default is 5 seconds.

      • ConnectionTimeout — Number of seconds to wait for a connection to be established with the Gateway server. Valid values are 2 through 300 (5 minutes). The default is 5 seconds.

  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.PassPhrase = 1
   set gw.LogFile  = "C:\Temp\GatewayTwo.log"
   set gw.AllowedIPAddresses  = ""
   set gw.FilePath  = "C:\Intersystems\Cache\dev\dotnet\bin\v2.0.50727"
   set gw.Exec64 = 1
   set gw.DotNetVersion = "2.0"
   set gw.HeartbeatInterval  = "10"
   set gw.HeartbeatFailureTimeout  = "30"
   set gw.HeartbeatFailureAction  = "R"
   set gw.HeartbeatFailureRetry  = "300"
   set gw.InitializationTimeout  = "5"
   set gw.ConnectionTimeout  = "5"

 // 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, 4.0, and 4.5. The following versions are shipped (where install-dir is the path that $SYSTEM.Util.InstallDirectory() returns on your system).

.NET Version 2.0:

  • install-dir\dev\dotnet\bin\v2.0.50727\DotNetGatewaySS.exe

  • install-dir\dev\dotnet\bin\v2.0.50727\DotNetGatewaySS64.exe

.NET Version 4.0:

  • install-dir\dev\dotnet\bin\v4.0.30319\DotNetGatewaySS.exe

  • install-dir\dev\dotnet\bin\v4.0.30319\DotNetGatewaySS64.exe

.NET Version 4.5:

  • install-dir\dev\dotnet\bin\v4.5\DotNetGatewaySS.exe

  • install-dir\dev\dotnet\bin\v4.5\DotNetGatewaySS64.exe

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.

FeedbackOpens in a new tab