This article has been excerpted from book "The Complete Visual C# Programmer's Guide" from the Authors of C# Corner.
It is also possible for Internet Information Server (IIS) to host remote objects. The Web-hosting example is in the Sample1 folder. The console client project is named WebClientExe.
To use IIS as a server, you must take a number of steps:
-
The remote object must be server activated.
-
Map a virtual directory, on the Web server, to the SimpleObjectLib folder.
-
The remote object can't be programmatically configured. It must use a web.config file in the virtual directory's root, see Listing 25.26.
Listing 25.26: Web.config
<?xml version="1.0" ?>
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown
mode="SingleCall"
type="SimpleObjectLib.SimpleObject, SimpleObjectLib"
objectUri="Simple.rem">
</wellknown>
</service>
<channels>
<channel
name="Server-Activated Web Client"
type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
You should be aware of a number of items in the configuration file:


Join the conversation! Your thoughts help the community grow.