472,779 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 19575
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.