IIS and Remoting


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 Inetpub\wwwroot directory.

2.

Under the SampleService directory, create a subdirectory named bin.

3.

On your local machine, create a virtual directory called SAMSSampleService and point it to the SampleService directory you created in step 1. You can use all the defaults when creating the virtual directory.

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 SampleService\bin 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.

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> 



    Visual C#. NET 2003 Unleashed
    Visual C#. NET 2003 Unleashed
    ISBN: 672326760
    EAN: N/A
    Year: 2003
    Pages: 316

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net