H
Hank
Hi,
I have client and server.
First client calls server, server uses the factory pattern to create a new
domain "newDomain" and object from the domain "newObject".
At certain point, after using the newObject, client need to call server to
dispose the newObject and unload the newDomain.
I tried to unload the newDomain in the newObject.Dispose method, got an
exception. In general, people unload AppDomain from another appdomain. So
I tried a different way. Before client calls the newObject.Dispose method,
it first calls the newObject.GetDomainId() as following:
Client:
......
int domainId = newObject.GetDomainId();
newObject.Dispose(); //Dispose won't call
AppDomain.Unload(CurrentDomain), no exeception thrown
serverFactory.UnloadDomain(domainId); //client calls the main process
domain to unload domain with domainId
......
Server:
class ServerFactory //in the server main process domain
{
void UnloadDomain(int domainId)
{
//HOW do I find the appdomain with domainId, so I can call
AppDomain.Unload( AppDomain ad)
}
}
So I am stuck in the server side, how the server find the domain with
domainId, in other words, more generally is there any method server can call
to get the list of appdomains?
Your help is highly appreciated!
Hang
I have client and server.
First client calls server, server uses the factory pattern to create a new
domain "newDomain" and object from the domain "newObject".
At certain point, after using the newObject, client need to call server to
dispose the newObject and unload the newDomain.
I tried to unload the newDomain in the newObject.Dispose method, got an
exception. In general, people unload AppDomain from another appdomain. So
I tried a different way. Before client calls the newObject.Dispose method,
it first calls the newObject.GetDomainId() as following:
Client:
......
int domainId = newObject.GetDomainId();
newObject.Dispose(); //Dispose won't call
AppDomain.Unload(CurrentDomain), no exeception thrown
serverFactory.UnloadDomain(domainId); //client calls the main process
domain to unload domain with domainId
......
Server:
class ServerFactory //in the server main process domain
{
void UnloadDomain(int domainId)
{
//HOW do I find the appdomain with domainId, so I can call
AppDomain.Unload( AppDomain ad)
}
}
So I am stuck in the server side, how the server find the domain with
domainId, in other words, more generally is there any method server can call
to get the list of appdomains?
Your help is highly appreciated!
Hang