This is the last resort after many days of searching on Google to try and find the final answer to my question.
I created a Windows service, a Windows form, and a Remoting object (all in C #). I am using a Remoting object to communicate between a service and a form using events.
Here's a simplified example of a typical interaction between objects:
- AdminForm calls RemoteObject RequestLoadForm () method
- RemoteObject fires an event that AdminService is listening
- AdminService is notified of the event and calls LoadFormData (string data) in RemoteObject
- RemoteObject fires an event that AdminForm is listening
- AdminForm is notified of the event and can use string data to set values in AdminForm elements
Everything works fine, everything interacts perfectly for the first 5 minutes or so. After that, the connection between the objects is somehow broken, and I can no longer communicate between the objects.
The first attempt to fix the problem was to overwrite the InitializeLifetimeService method to return null. This did not help (although this can avoid any future rental issues).
The second attempt was to make my AdminForm and AdminService ISponsors RemoteObject and configure them to extend the lease of the facility. Once again, the problem persists.
In my various googlings, I found that someone mentions something about event handlers that collect garbage. I am not sure if this is a problem or not, but I thought I would say that.
This is an error that appears after the connection has been idle for> 5 minutes:
System.Runtime.Remoting.RemotingException failed to process user code
Message = "The requested service was not found"
Source = "system.runtime.remoting"
Now it’s strange that this happens on the AdminService side. AdminForm calls the method on the remote object . This is a pop-up event, and then the AdminService sees this event and tries to call the RemoteObject LoadFormData method (string data), and this is where the exception is thrown.
I’m completely exhausted from Google searches, since I can’t find what I need to fix it.
Matt p
source share