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:
1. | Create a directory called SampleService in the Inetpubwwwroot directory. |
2. | Under the SampleService directory, create a subdirectory named bin. |
3. | |
4. | Cut and paste the code in Listing 39.6 into a file named web.config and save that file in the SampleService directory. |
5. | Copy the Chapter41Common.dll file from the build directory to the SampleServicein directory. |
6. | Modify the shaded code in Listing 39.5 by removing the port designation (http://localhost:9000 should become http://localhost). |
7. | Build and run the client application. |
After the application has been built and run, you should see the same results as you did by running the server and the client.
3.129.42.134