TargetInvocationException when calling Activator.CreateInstance -
11-07-2006
, 01:59 PM
Hello everyone,
I use an application to start and stop a service and get information
from the service. When the service is started, I use a client activated
object to exchange information with the service. When I stop the
service, I stop to renew the lease and assing my object to null. It
work fine the first time, but if I try to stop the service and start it
again, the service started, but I get a the following exception when
Activator.CreateInstance is called :
System.Reflection.TargetInvocationException was caught
Message="Exception has been thrown by the target of an invocation."
Inner Exception : IOException
Message="The write operation failed, see inner exception."
Inner Exception : SocketException
Message="An existing connection was forcibly closed by
the remote host"
If I wait about 10 seconds between the stop and start, it works fine.
Any idea? Do I have to release something else when I don't need a
remote object anymore?
Thanks |