This document contains the
release information for the NGWS ObjectZone sample. You will find the following sections below:
This sample demonstrates how COM objects get remoted similar to managed objects.
This sample is located in
the Remoting directory of the NGWS SDK sample directories.
For Example,
the server object is located at:
C:\Program
Files\NGWSSDK\Samples\Remoting\COMZone
And the
client object at:
C:\Program
Files\NGWSSDK\Samples\Remoting\MyCOM
All remoting examples can be build at once by
invoking NMAKE from the Remoting directory as follows prior to running
the samples…
·
Change to
the Remoting directory and type NMAKE ALL
For Example:
C:\Program
Files\NGWSSDK\Samples\Remoting\:>NMAKE All
·
Alternatively,
go to the individual client and server directories, and build them
individually.
For Example:
C:\Program
Files\NGWSSDK\Samples\Remoting\COMZone:>NMAKE All
C:\Program Files\NGWSSDK\Samples\Remoting\MyCOM:>NMAKE All
Open two command windows. Start the server in one window by entering the following at the
command line
MyHost
-cfg COMZone.cfg
You should get the following output
MyHost is ready to process remote messages.
Press a key and ENTER: G=GC.Collect, 0=Exit
Start the client in another command window
and enter the following
MyCOMRate
-s2 -cfg MyCOM.DirectHTTP.cfg
Sample2.bat will execute the command above and is
provided for convenience. You can also
run the other direct HTTP sample in this directory by entering the following
MyCOMRate -s4 -cfg MyCOM.DirectHTTP.cfg
Sample4.bat will execute this command and is provided for convenience.
The server process should echo the following to the command line
It
is also possible to access the server object through Internet Information
Server using HTTP. First we have to
tell IIS about our object by setting up a Virtual Root as follows:
Since the object will automatically be instantiated via the ASP framework, we don't have to start the server app when using normal HTTP.
Run the client by entering the following
MyCOMRate -s1 -cfg
MyCOM.cfg
You can also execute a different part of the sample by entering the following
MyCOMRate -s3 -cfg
MyCOM.cfg
The client examples should produce exactly the same output we obtained above. The only difference between this and the previous example is that we are using a WEB server to publish the server object and the client gains access to the server object via the WEB server.
We can also run the client from a WEB browser using ASP+. Start Internet Explorer and enter the following Address
http://localhost/MyCOM/MyComRate.aspx
The specified ASP+ page will be loaded that prompts you for a name. The output is similar to the previous examples, except that the output is displayed in the browser rather than the command line. This example assumes you have already set up the Virtual Root described above.