Client-activated Remote Object Client Sample: Hosted in IIS

Whenever a Web service or a remote object is generated, a configuration file is also created. Below is a sample of a simple task execution using a client-actived remote object hosted in IIS and a sample configuration file.

using System;
using System.Runtime.Remoting;

namespace CSharpClient
	/// <summary>
	/// A simple console application that demonstrates how to execute a task
	/// via a client-activated remote object.  This project references a
	/// generated assembly called Test.dll.  The remote component is hosted in
	/// IIS.
	/// </summary>
	class Class1
		/// The main entry point for the application.
		static void Main(string[] args)
			Test.RemoteTest remoteTest = null;

				//Configure RemoteTest as a client-activated object 
				(hosted in IIS)

				//Instantiate the remote object
				remoteTest = new Test.RemoteTest();

				//Prepare the remote object for stateful execution;
				//Set the task inputs
				Test.TaskInput.TaskScreenInputs inputs = new Test.TaskInput.TaskScreenInputs();
				inputs.Input = "data";

				//Execute the task
				Test.TaskOutput.TaskScreenOutputs outputs = remoteTest.Task(inputs);

				//Display the output
			catch (Exception xx)
				//Clean up

Sample Configuration File for Client-activated RemoteTestClient.config

<?xml version="1.0" encoding="UTF-8"?>
<!-- Configuration for a client-activated RemoteTest object
 - hosted in IIS. -->
<client url="http://localhost/Test">
<activated type="Test.RemoteTest, Test"/>
<channel ref="http">
<formatter ref="binary"/>

Related Topics
Bullet Using Tasks in Your Applications, Overview
Bullet Using .NET