It is also possible for Internet Information Server (IIS) to host remote
objects.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:
-
No port number need be specified, as IIS has already been configured to listen on a port, normally port 80.
-
The objectUri attribute in the wellknown element must use the extension .rem or .soap.
The client code remains the same as previous server-activated examples (see Listing 25.27). The client output is shown in Figure 25.16.
Listing 25.27: WebClient.vb
Protected Sub Calendar_Selection(ByVal
sender As [Object],
ByVal e As EventArgs)
ChannelServices.RegisterChannel(New
HttpChannel())
Dim simple As
SimpleObject = Nothing
simple = DirectCast(Activator.GetObject(GetType(SimpleObject),
"http://localhost/WebRemoting/Simple.rem"),
SimpleObject)
Dim ret As String = Nothing
ret = simple.ConCatString("using the",
"Web for remoting.")
End Sub
Figure 25.16: WebClientExe Output

Conclusion
Hope this article would have helped you in understanding Remoting over the Web in VB.NET.