.Net Remoting Question
My understanding of .Net Remoting is limited (and probably imperfect), so please bear with me.
I've created a service that is hosting a singleton remoted object. It appears that the remoted object doesn't exist until a client attaches to the remoted object. Is this true? If so, how can I creat开发者_开发知识库e an instance of the object in the service?
Thanks Paul.
I'm pretty sure that there is no way to do this without calling a method on the object - It's just how server activation works.
You don't indicate why you need to do this, but I'd guess it is because the initialization of the singleton takes a while. Perhaps you could factor off the initialization into another class which is loaded at application startup, and this would reduce the singleon startup costs.
Thanks for you answer!
Actually, I found a way to get what I wanted. The key is that the object that is being hosted for remoting (as a singleton) needs to be a thin wrapper for an actual singleton object (as in Singleton<>). This way the base object will be created no matter what and the remotely hosted object will then be a wrapper for the internal singleton.
精彩评论