Using the Object Gateway for .NET
Setting Object Gateway Server Properties
Properties of the ObjectGateway
class specify the settings used by the Service
class (see “Running an Object Gateway Server
”) to access and monitor an instance of the Object Gateway Server. This chapter covers the following topics:
While it is possible to specify the settings for an Object 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:
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 an Object Gateway's log of recent activity, start or stop an Object Gateway, and create, edit, or delete an Object Gateway Server definition.
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
Fill out the form and click Save
. The following properties of ObjectGateway
can be set:
Name — Required. A name that you assign to this Object Gateway definition.
Server — Required. IP address or name of the machine where the Object Gateway server executable is located. The default is "127.0.0.1".
. TCP port number for communication between the Object Gateway server and the proxy classes in InterSystems IRIS™. Several methods of class Service
(see “Running an Object Gateway Server
”) accept the port number as an optional parameter with a default value of 55000
PassPhrase — If this property is checked, the Object Gateway will require a passphrase to connect.
LogFile — Full pathname of the file used to log Object Gateway messages. These messages include acknowledgment of opening and closing connections to the server, and any difficulties encountered in mapping .NET classes to InterSystems IRIS 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 0.0.0.0 (the default) to listen on all IP adapters on the machine (including 127.0.0.1, 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 Object Gateway server executable is located. This is used to find the target executable and assemble the command to start the Object 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 Object 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.
— Specifies the .NET version (2.0 or 4.0) to be used (see “Object Gateway Server Versions
”). Defaults to .NET 2.0.
Advanced settings (hidden by default)
HeartbeatInterval — Number of seconds between each communication with the Object 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 Object Gateway is in failure state. If this value is smaller than the HeartbeatInterval property, the Object Gateway is in failure state every time the Object Gateway communication check fails. The maximum value is 86400 seconds (1 day). The default is 30 seconds.
HeartbeatFailureAction — Action to take if the Object Gateway goes into a failure state. Valid values are "R" (Restart) or "N"(None). The default action is Restart, which causes the Object Gateway to restart.
HeartbeatFailureRetry — Number of seconds to wait before retrying the HeartbeatFailureAction if the Object 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 Object 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 Object Gateway server. Valid values are 2 through 300 (5 minutes). The default is 5 seconds.
After saving the form, go back to the Object Gateways page. Your new Object Gateway Server definition should now be listed there.
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 Object Gateway (rather than an Object Gateway for Java).
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 Object Gateway
set gw = ##class(%Net.Remote.ObjectGateway).%New()
set gw.Type = "2" // an Object Gateway for .NET, not Java
// Set the properties
set gw.Name = "GatewayTwo"
set gw.Server = "127.0.0.1"
set gw.Port = "55000"
set gw.PassPhrase = 1
set gw.LogFile = "C:\Temp\GatewayTwo.log"
set gw.AllowedIPAddresses = "0.0.0.0"
set gw.FilePath = "C:\Intersystems\IRIS\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).
Different versions of the Object 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:
.NET Version 4.5:
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 InterSystems IRIS installation procedure does not install or upgrade any version of the .NET Framework.
Content Date/Time: 2019-09-18 06:45:48