HOWTO: Use ASP.NET projects as Remoting clients?
Question
I want to use an ASP.NET Web Page as a client for .NET Remoting. After putting all the client side channel and object registrations into web.config (for the client-side project), the framework fails to remote any calls. What did I do wrong?
Answer
When you include a <client> section within the Web.config file, ASP.NET doesn't throw an exception but you won't connect to the tier running on another machine.
And you can't put in another Web.config so ...
I created a global.asax file with a single Application_OnStart(). I then read another config file (which is of "Client" style for .NET Remoting) from that method by using RemotingConfiguration.Configure(). Both client.exe.config and global.asax are sitting in the virtual directory of the ASP.NET web application:
Looks like this:
<script runat="server" language="vb">
Sub Application_OnStart()
RemotingConfiguration.Configure(Request.PhysicalApplicationPath + "client.exe.config")
End Sub
</script>