Multimobile Development: Building Applications for any Smartphone
Requested service not found after a while
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.


Chris Soulsby
I have application which hides itself after it is closed and places a icon
in task tray. When you run the program it will check to see if its running
and if it is then contact the application using remoting and tell it to show
its self.

This seems to work fine, however, after a while it seems to loose the
remoting server. The client application gets a RemotingException "Requested
Service not found". The server application is still running in the task
tray.

Does anyone know why it would work for a while then stop?

The following code is used on the server:

// create a server
System.Runtime.Remoting.RemotingServices.Marshal(this, NAME);
Hashtable ht = new Hashtable();
ht["bindTo"] = "127.0.0.1";
ht["port"] = "0";
m_oTcpChannel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(ht,
null, null);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(m_oTcpChann
el);

// write url to isolated storage
IsolatedStorageFile isoFile;
isoFile = IsolatedStorageFile.GetUserStoreForDomain();
IsolatedStorageFileStream isoStream =
new IsolatedStorageFileStream(FILENAME,
FileMode.OpenOrCreate,
FileAccess.Write,
isoFile);
StreamWriter writer = new StreamWriter(isoStream);
writer.WriteLine(m_oTcpChannel.GetUrlsForUri(NAME)[0]);
writer.Close();
isoFile.Dispose();
isoFile.Close();
....
Application.Run();

And the following code is used on the client:

// read the url from the file
IsolatedStorageFile isoFile =
IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
IsolatedStorageScope.Assembly |
IsolatedStorageScope.Domain ,
null,
null);
IsolatedStorageFileStream isoStream =
new IsolatedStorageFileStream(FILENAME,
FileMode.Open,
FileAccess.Read,
FileShare.Read);
StreamReader reader = new StreamReader(isoStream);
string strMutex = reader.ReadLine();
reader.Close();
isoFile.Close();

try
{
// create a remote instance of this class
SingleInstanceClass o =
(SingleInstanceClass)System.Runtime.Remoting.RemotingServices.Connect(typeof
(SingleInstanceClass), strMutex);
o.MultipleInstances();
}

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
Allen Anderson
how are you handling your lifetime services? Are you making a new
object/connection each time you wake up or are you trying to re-use
the same connection? Remoting services will time your object out
after a few minutes unless you implement either a null lifetime
(forever) or sponsors/leases to control exactly how long the object
will live. The easiest to do this in your particular low use case
would probably just be to create a new remote object each time you
want to change the state of your application.

Allen Anderson
http://www.glacialcomponents.com
mailto: allen@put my website url here.com

On Thu, 8 Apr 2004 15:33:49 +0100, "Chris Soulsby"
<chris.soulsby(at)sysinx.com> wrote:

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
Edward J. Stembler
The connection dies after 5 mins. You have to override
InitializeLifetimeService or create a lease.

Here's an example of overriding ILS:

public override object InitializeLifetimeService()
{
return null; // return null to live forever
}

"Chris Soulsby" <chris.soulsby(at)sysinx.com> wrote in message news:<Click here to reveal e-mail address>...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Ice
So lets say I'm using a SingleCall object, as far as the object finishes it
work in under 5 minutes I'm golden. With Singletons, its almost common
sense that the object live forever and so I would have to override the
lifetime. However, with CAOs, leases and lifetime would definitely have to
thought out a little more as the client should be in charge of how long the
object should live.

ice

"Edward J. Stembler" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First chapters of Multimobile Development book now available on Apress Alpha program
iPad
 
    
Dilip Krishnan
You would proably need to have a sponsor to renew the lifetime of the
remoting server object

Chris Soulsby wrote:

[Original message clipped]

--
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilipdotnet at apdiya dot com
Reply to this message...
Vote that this is a GOOD answer...
 
New book project – Multimobile Development: Building Applications for any Smartphone
Dive into HTML5
 
 
System.Collections.Hashtable
System.IO.FileAccess
System.IO.FileMode
System.IO.FileShare
System.IO.IsolatedStorage.IsolatedStorageFile
System.IO.IsolatedStorage.IsolatedStorageFileStream
System.IO.IsolatedStorage.IsolatedStorageScope
System.IO.StreamReader
System.IO.StreamWriter
System.Runtime.Remoting.Channels.ChannelServices
System.Runtime.Remoting.Channels.Tcp.TcpChannel
System.Runtime.Remoting.RemotingException
System.Runtime.Remoting.RemotingServices
System.Windows.Forms.Application




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734