473,394 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Remoting object - "Requested Service Not Found"

Hi All,

I have a Windows Service that runs well. The service hosts a remote object.
The purpose of the object is so that I can "peak" into the service to see
what it's doing. I wrote a small Windows Application that connects to the
remote object and prints out status information.
Everything works fine when I first start the service. However, after some
period, when I attempt to connect to the remote object, I get "Requested
Service not Found" when I try to bind to it.

I can confirm that the Service is still running, because it is doing what it
is supposed to be doing (processing logfiles) but the Remote Object isn't
working. The Remote Object is instantiated in the main thread for the
service, so it's not that the remote object is getting destroyed.

Some more troubleshooting shows that it isn't on the second connection
attempt that I cannot connect. I thought it might be the local object
destroying the remote object when the "client" app closes. This doesn't seem
to be the case.

The instance of the remote object is populated by the service with
information as it is running. So I'm fairly certain the the actual instance
of the object still exists, because if it was destroyed, then the service
would probably crash, which it doesn't.

Anyone have any ideas on what I'm doing wrong or not doing?

Here is the server side code that creates the object: (Object name is
"AllStatus")

HttpChannel channel = new
HttpChannel(Convert.ToInt32(ConfigurationSettings. AppSettings["StatusPort"])
);
ChannelServices.RegisterChannel(channel);
ObjRef refl = RemotingServices.Marshal(AllStatus,"objectluri");

Here is the client code that attempts to connect to it:

string RemoteConnection = "http://" + this.textBox1.Text + ":" +
this.textBox3.Text + "/objectluri";

RemotingConfiguration.RegisterWellKnownClientType( typeof(SessionLogger.Servi
ceStatus),RemoteConnection );
object1 = new SessionLogger.ServiceStatus();

To get the obvious questions out of the way, yes, I'm sure that the host and
port numbers are the same.

Thanks in Advance..

Steve



Nov 16 '05 #1
3 19676
Steve,

Is there a reason why you are not registering the type on the service
side? My guess is that you are marshaling a reference, and that the lease
is dying out. You should be configuring the type on the server to be
marshaled (using the static RegisterWellKnownServiceType method on the
RemotingConfiguration class).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve Lutz" <sl*********@comcast.net> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl...
Hi All,

I have a Windows Service that runs well. The service hosts a remote object. The purpose of the object is so that I can "peak" into the service to see
what it's doing. I wrote a small Windows Application that connects to the
remote object and prints out status information.
Everything works fine when I first start the service. However, after some
period, when I attempt to connect to the remote object, I get "Requested
Service not Found" when I try to bind to it.

I can confirm that the Service is still running, because it is doing what it is supposed to be doing (processing logfiles) but the Remote Object isn't
working. The Remote Object is instantiated in the main thread for the
service, so it's not that the remote object is getting destroyed.

Some more troubleshooting shows that it isn't on the second connection
attempt that I cannot connect. I thought it might be the local object
destroying the remote object when the "client" app closes. This doesn't seem to be the case.

The instance of the remote object is populated by the service with
information as it is running. So I'm fairly certain the the actual instance of the object still exists, because if it was destroyed, then the service
would probably crash, which it doesn't.

Anyone have any ideas on what I'm doing wrong or not doing?

Here is the server side code that creates the object: (Object name is
"AllStatus")

HttpChannel channel = new
HttpChannel(Convert.ToInt32(ConfigurationSettings. AppSettings["StatusPort"]) );
ChannelServices.RegisterChannel(channel);
ObjRef refl = RemotingServices.Marshal(AllStatus,"objectluri");

Here is the client code that attempts to connect to it:

string RemoteConnection = "http://" + this.textBox1.Text + ":" +
this.textBox3.Text + "/objectluri";

RemotingConfiguration.RegisterWellKnownClientType( typeof(SessionLogger.Servi ceStatus),RemoteConnection );
object1 = new SessionLogger.ServiceStatus();

To get the obvious questions out of the way, yes, I'm sure that the host and port numbers are the same.

Thanks in Advance..

Steve



Nov 16 '05 #2
Are you instantiating the remoting object in Main() ??? That's probably not the right place to do it - try initialising your remoting layer in the OnStart() event

There's an article here that describes something similar to what you are doing
http://msdn.microsoft.com/library/de...et11272001.asp
Nov 16 '05 #3
Hi Nicholas,

I was able to figure out the problem, it WAS because the lease was dying. My
problem is that I needed the remote client to connect to the same instance
of the object, not a new one. I read that if I did a singleton, it would
only create one object of the class, but it seems that it was creating one
instance of the class for remote clients, and one for non-remote. This
wouldn't work, and this is the only way I could find to have a remote client
connect to the same instance of a local instantiated object.

I fixed it by overriding the default
MarshalByRefObject.InitializeLifetimeService to return null, which tells
Remoting that the lease should never expire.

Unless you know of a way to have a remote object connect to an exisiting
instance of a class that the server created, I think I'm going to stick with
this method.

Thanks

Steve

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Steve,

Is there a reason why you are not registering the type on the service
side? My guess is that you are marshaling a reference, and that the lease
is dying out. You should be configuring the type on the server to be
marshaled (using the static RegisterWellKnownServiceType method on the
RemotingConfiguration class).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve Lutz" <sl*********@comcast.net> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl...
Hi All,

I have a Windows Service that runs well. The service hosts a remote object.
The purpose of the object is so that I can "peak" into the service to see what it's doing. I wrote a small Windows Application that connects to the remote object and prints out status information.
Everything works fine when I first start the service. However, after some period, when I attempt to connect to the remote object, I get "Requested Service not Found" when I try to bind to it.

I can confirm that the Service is still running, because it is doing what it
is supposed to be doing (processing logfiles) but the Remote Object

isn't working. The Remote Object is instantiated in the main thread for the
service, so it's not that the remote object is getting destroyed.

Some more troubleshooting shows that it isn't on the second connection
attempt that I cannot connect. I thought it might be the local object
destroying the remote object when the "client" app closes. This doesn't

seem
to be the case.

The instance of the remote object is populated by the service with
information as it is running. So I'm fairly certain the the actual

instance
of the object still exists, because if it was destroyed, then the service would probably crash, which it doesn't.

Anyone have any ideas on what I'm doing wrong or not doing?

Here is the server side code that creates the object: (Object name is
"AllStatus")

HttpChannel channel = new

HttpChannel(Convert.ToInt32(ConfigurationSettings. AppSettings["StatusPort"])
);
ChannelServices.RegisterChannel(channel);
ObjRef refl = RemotingServices.Marshal(AllStatus,"objectluri");

Here is the client code that attempts to connect to it:

string RemoteConnection = "http://" + this.textBox1.Text + ":" +
this.textBox3.Text + "/objectluri";

RemotingConfiguration.RegisterWellKnownClientType( typeof(SessionLogger.Servi
ceStatus),RemoteConnection );
object1 = new SessionLogger.ServiceStatus();

To get the obvious questions out of the way, yes, I'm sure that the host

and
port numbers are the same.

Thanks in Advance..

Steve




Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BKDotCom | last post by:
I'd like to serve an image-not-found image for images... that aren't found.. I'm already using a custom 404 handler page.. but this question could apply to images retrieved from a database or...
0
by: Ari Royce Hidayat | last post by:
Dear ALL, Is there some one ever faces this problem? And fix it? The scenario is: There's an html page that hosts a .net object (using object tag), and this page opens the second html page...
0
by: Ari Royce Hidayat | last post by:
Tx a lot for idea. I've tried it, and still get not clue what causes it. I also tried to see the log file generated by IEHost (by adding IEHostLogFile to registry) and still get not clue what...
2
by: Andy Norman | last post by:
I have a strange problem. When I try to call the input property of the MSXML processor object from VBScript in an ASPX page I get the error "Member not found". The same code (with a few "set"...
7
by: hazz | last post by:
this is a repost with more concise code (well, for me) and better questions (I hope....) . given the following two classes, my intent is to use either Activator.CreateInstance or InvokeMember pass...
5
by: Nick | last post by:
Hi there, I despearately need to get IIS working with ASP.NET, but I still can't see any "Web Service Extensions". My previous question regarding this ended in the decision to uninstall .NET...
3
by: Charles Law | last post by:
This is driving me mad. Can someone please put me out of my misery? I have a DataSet which I wish to use as the data source for a grid control (it is actually an Infragistics grid). When I assign...
3
by: andersond | last post by:
I want input objects to have a light yellow background when they have focus. Here's how I call my function: input name="monthsVacant" id="monthsVacant" disabled="disabled"...
6
by: rahulsengupta895 | last post by:
. #define MIN(a,b) (a<b?a:b) #define MAX(a,b) (a>b?a:b) #include "Video.h" #define NO_HUE -1
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.