Export (0) Print
Expand All

Custom Proxies Technology Sample

This sample demonstrates the extensibility of the RealProxy class. By extending RealProxy, user code gains access to the messages that are transported to and from any remote object. The sample creates three executable files. The ProxyWithReturnMessage.exe application overrides the Invoke method to display message data. The ProxyWithCustomCasting.exe application uses two interfaces, named IFaq and IBaz, to demonstrate custom casting capabilities. The ProxyWiredToHttpChannel.exe application shows how to intercept and forward the call to the RemotingHello service using the Http Channel.

NoteImportant

This sample requires that Internet Information Services (IIS) be installed on your computer. You must register the RemotingHello service with IIS before running sample applications.

For information about using the samples, see the following topics:

To build the sample using the Command Prompt

  1. Open a Command Prompt window and navigate to the CS subdirectory.

  2. Type msbuild CustomProxiesCS.sln at the command line.

    NoteNote

    This sample builds three console applications. You must launch and run them using the command prompt in order to view their output.

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to the CS subdirectory.

  2. Double-click the icon for CustomProxiesCS.sln to open the file in Visual Studio.

  3. On the Build menu, choose Build Solution.

To register the service in IIS

  1. Compile the service to a DLL and copy this DLL to a bin directory where the service will be loaded from. Building the sample using the Command Prompt or Visual Studio as described above compiles the service, creates the bin subdirectory under ProxyWiredToHttpChannel and copies Hello.dll there.

  2. Start Internet Services Manager and select Default Web Site under the server node. Select Action, New, Virtual Directory on the menu and click Next to continue.

  3. Enter RemotingHello as the alias and press Next.

  4. Enter the directory where the service is located. Enter the full path up to but excluding the bin directory where the dll in step 1 was copied to.

  5. Press Next. Accept the defaults presented and press Next again. Press Finish. The service has now been registered and will appear under the list of Default Web Sites in the Internet Services Manager window.

  6. Ensure that there is a web.config file in the directory where the service was registered. This file describes your service and will automatically be loaded when a client attempts to access your service with a browser or client using the HTTP channel on port 80.

To run the sample

  1. Navigate to the directory that contains one of the three executable files:

    • ProxyWiredToHttpChannel.exe

    • ProxyWithCustomCasting.exe

    • ProxyWithReturnMessage.exe.

    Each executable is located in the \bin\Debug subdirectory under the directory with the same name as the console application.

  2. Type the name of the executable file at the command line. Ensure that the RemotingHello service is registered with IIS as described above before running ProxyWiredToHttpChannel.exe.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft