i used this method
http://hman.pastebin.com/2b7ng3Ss to raise event from plugin and it work fine if plugin generate event in first minutes, if plugin try to generate event after some stand by minutes, i obtain an exception:
Unhandled Exception: System.Runtime.Remoting.RemotingException: No receiver for uri
could you help me ?
This is by design. When using Remoting, you can get burned if you do not know anything about LifetimeServices. Basically, when you obtain an instance from a Remoting server, you're on borrowed time - the client-side has five minutes (the default) to finish all the work using the proxy object.
If you idle for more than five minutes, the CLR will dispose the instance. This is obviously for memory management purposes. Since you haven't posted the details of your program, I'll go over a simplified scenario.
Code:
[Serializable]
class ServerAppDomain : MarshalByRefObject
{
// Do work
}
class ClientAppDomain
{
// Your Remoting proxy
ServerAppDomain proxy = new ServerAppDomain;
}
In the above scenario, assume that the ClientAppDomain is where you request an instance of an object across contextual boundaries. The CLR will automatically serialize an instance of ServerAppDomain, import it into ClientAppDomain, and deserialize the instance of ServerAppDomain to make it usable. All this happens behind the scene - at the same time, the CLR knows that this is a Remoting object, so it allocates the default five-minute lifeline to the instance. If you do not utilize the proxy for five minutes, the Remoting object will be garbage collected.
So, when you try and invoke the a method using the "proxy" object in the ClientAppDomain, you'll get RemotingException. Which is counter-intuitive because your client still holds a reference to the server.
Long story short, this is a common possibility, wherein the client may be sitting idle for a long period of time. The way you can give your server an eternal life is by overriding the
InitializeLifetimeService() method in the ServerAppDomain and returning null. So doing the following should work:
Code:
[Serializable]
class ServerAppDomain : MarshalByRefObject
{
/// <summary>
/// Indicates to the Remoting environment that the lease
/// for the Remoting objects never expires.
/// </summary>
/// <returns>Null to indicate that the object stays alive forever.</returns>
public override Object InitializeLifetimeService()
{
return null;
}
// Do work
}
Of course, I am assuming that the "lease expiration issue" is, in fact, the problem you're facing.