.NET Remoting - DLL Referencing Dilemma
-
10-10-2019 - |
Question
I have created two projects to understand the basics of .NET Remoting.
- Server Project: I created the class library of RemoteObject within server solution.
- Client Project: I create proxies from this project to use RemoteObject of Server.
The problem: Client has two know about the types that it is remoting. But how can it do that? Do you think Client should reference RemoteObject dll in server project. I think it is useless if these projects are distributed on different machines. Similarly, copying the dll to the client sounds bad. So what the optimal solution should be?
Thank you,
Solution
Create the interface that has the functionality you need in separate dll.
In server, derive from that interface and implement functionality. In client, reference the interface and create remote proxy for it, which will give you access to server implementation but at the same time you won't ship your server code with the client.
OTHER TIPS
Have a look at
- Using Interfaces In .NET Remoting
- NET REMOTING .. The Interface Approach
- Remoting An Interface Based Approach
Ultimately you should also have a look at What Is Windows Communication Foundation
You need 3 projects:
- one with shared interfaces
- one with the server implementation of those interfaces
- one with the client components.
Both the server and the client, will need to reference the assembly with the shared interfaces.