I’d like to create a Window Service that can load several DLLs from a certain location and publish them using Remoting on a specific TCP port (let’s say 9000).
Each DLL contains a single class that will published.
For example (Test.dll)
namespace Test
{
class Service
{
// methods here
}
}
The service should publish it using Remoting tcp://<servername>:9000/Test.dll
I know how to use Remoting but I’d like to know how to implement the service so that it can load the DLLs dynamically when starting and unload them when stopping.
May be there’s another way to do this?
You can use the many methods in the Assembly class to achieve this, they’re loaded into the AppDomain which will be unloaded with the service when you stop it.
Check out: http://msdn.microsoft.com/en-us/library/system.reflection.assembly.loadfile.aspx