Microsoft KB Archive/323490

= INFO: Configure .NET Remoting When the Remoting Client Is an ASP.NET Application or the Client Is Another Remoted Component That Is Hosted by IIS =

Article ID: 323490

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft ASP.NET 1.0
 * Microsoft ASP.NET 1.1
 * Microsoft .NET Framework 1.0
 * Microsoft .NET Framework 1.1
 * Microsoft Internet Information Services 5.0
 * Microsoft Internet Information Services 6.0
 * Microsoft Internet Information Services 5.1

-



This article was previously published under Q323490



IN THIS TASK

 * SUMMARY
 * Configure Remoting Client in Global.asax
 * Use Application_Start to Configure Remoting Client
 * Remoting Client Configuration File
 * Remote Components Hosted by IIS
 * REFERENCES



SUMMARY
This article describes configuration information for .NET remoting when the remoting client is an ASP.NET application or the client is another remoted component hosted by Internet Information Services (IIS).

back to the top

Configure Remoting Client in Global.asax
When you use a remote .NET component from an ASP.NET page, or from another IIS-hosted component, you must establish the remoting configuration on application startup. You cannot set a client configuration (that works) in the Web.config file in this scenario. Instead, use the Application_Start event in Global.asax for the application to peform any remoting configuration.

IMPORTANT NOTE: The client configuration file can be any file, including Web.config. By default,  elements of Web.config are not read. To work around this behavior, in this example you must configure the client remoting configuration by using the Application_Start method.

By default,  elements in Web.config are read, however. For clarity, this example uses a separate configuration file for the client. You may include your client configuration in the Web.config file, but you still must call Configure in Application_Start.

back to the top

Use Application_Start to Configure Remoting Client
The following sample code is an example of the code that you add to the Application_Start method in the Global.asax to perform client remoting configuration: Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim sPath = Server.MapPath(&quot;ClientConfiguration.config&quot;) System.Runtime.Remoting.RemotingConfiguration.Configure(sPath)

End Sub back to the top

Remoting Client Configuration File
The following sample code is an example of the configuration code that you can use in the configuration file. This sample code demonstrates how to use a well-known endpoint, the http channel, and the binary formatter.                      back to the top

Remote Components Hosted by IIS
Use this method to set the remoting configuration when a remote component that is hosted by IIS is the client of another remote component. In this scenario, add a Global.asax file to the same virtual directory where the IIS-hosted remote component is located. Add configuration code to the Application_Start method as shown previously.

back to the top

Additional query words: net

