As shown in the previous sections, the remote object must be hosted by some server application. Listing 39.5 showed the code necessary to build a bare-bones hosting application. That was fairly simple, but an application has already been written that can do this for you. Internet Information Services (IIS) is an application that comes with Windows and is quite capable of hosting the remote object for you with minor changes to the application. The first change is that you must tell IIS where your object is located and how to host the remote object. You accomplish this through the use of a virtual directory and web.config file. To better illustrate this, follow these steps:
After the application has been built and run, you should see the same results as you did by running the server and the client.
Listing 39.8. Web.config
<configuration> <system.runtime.remoting> <application> <service> <wellknown mode="SingleCall" type="SAMS.VisualCSharpDotNetUnleashed.Chapter39.SampleService, Chapter41Common" objectUri="SampleService.Soap" /> </service> </application> </system.runtime.remoting> </configuration>