.NET Remote Client Object Sample Code: Client-activated, IIS Hosted, Client

A simple console application that demonstrates how to execute a task via a client-activated remote object. The remote component is hosted in IIS and includes a corresponding configuration file.

using System;
using System.Runtime.Remoting;

// NOTE: Add project reference to AMNUtask.DLL
// 1. Project \ Add Reference... menu item
// 2. Use Browse button to find and add DLL.
using AMNUtask;

namespace AMNUtaskRemote
  /// <summary>
  /// Summary description for Class1.
  /// </summary>
  class Class1
  /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main(string[] args)
      AMNUtask.RemoteAMNUtask remoteAMNUtask = null;

        //Configure RemoteAMNUtask as a client-activated object 
        //(hosted in IIS)
        RemotingConfiguration.Configure("C:\\Program Files\\Attachmate\\EAI\\CICSClient\\samples\\AMNU\\remote\\AMNUtaskRemote\\RemoteAMNUtaskClient.config");

        //Instantiate the remote object
        remoteAMNUtask = new AMNUtask.RemoteAMNUtask();

        //Prepare the remote object for stateless execution
        //Set the task inputs
        AMNUtask.AMNUInput.input input = new AMNUtask.AMNUInput.input();

        input.CICSUserInfo = new AMNUtask.AMNUInput.input_CICSUserInfo();
        input.CICSUserInfo.USER_ID = "USERID";
        input.CICSUserInfo.PASSWORD = "PW";

        input.FILE_XACT = new AMNUtask.AMNUInput.input_FILE_XACT();
        input.FILE_XACT.COMMCODE = "2";
        input.FILE_XACT.FILENAME = "FILEA";
        input.FILE_XACT.REC_KEY_FLD = "000102";

        //Execute the task
        AMNUtask.AMNUOutput.output output = remoteAMNUtask.AMNU(input);

        //Display the output
        System.Console.WriteLine("NAME: " + output.FILE_XACT.FILEREC.NAME);
      catch (Exception xx)
        //Clean up
        if (remoteAMNUtask != null)

Sample Configuration File: RemoteAMNUClient.config

<?xml version="1.0" encoding="UTF-8"?>
<!-- Configuration for a client-activated RemoteAMNUtask object
 - hosted in IIS.-->
<client url="http://localhost/AMNUtask">
<activated type="AMNUtask.RemoteAMNUtask, AMNUtask">
<channel ref="http">
<formatter ref="binary"/>
Related Topics
Bullet Using .NET
Bullet Adding .NET Remotable Objects to .NET Projects
Bullet .NET Deployment Examples