Link to home
Start Free TrialLog in
Avatar of dhodge
dhodge

asked on

Remoting

I am mid way through writing a .Net Remoted object.  I have the server, the client and the object.  Everything is operating normally.  My only issue with this whole affair is that I need to keep the server running at all times.

All the samples do something like :

chan = new TcpChannel(8085);
ChannelServices.RegisterChannel(chan);
System.Type typ = typeof(AuthEngine.CreditCardEngine);
RemotingConfiguration.ApplicationName = "CreditCardAuthAuthorization";
RemotingConfiguration.RegisterWellKnownServiceType (typ, "Authorization", WellKnownObjectMode.SingleCall);
ReadLine ("Press return to end")

This seems really flaky.  As a temporary measure I put this code in a form and made the channel a member variable which would destroy (ie unregister) when the form is closed.  This still means I have a floating form on the screen.

Q) Has anybody done anything more elegant than this?
ASKER CERTIFIED SOLUTION
Avatar of AvonWyss
AvonWyss
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sijin
Sijin

You could use a windows service. Use the new project wizard to select a windows service project and create a new windows service all the code is almost generated for you. Just move the above code to the OnStart() method of the service.

You may also need to add a installer to the project if you need to install the service, to do so you will have to goto design view of the service and click on the Add installer link.

Let me know if you face any problems.
It depends really. If, as you say, you are mid way through developing this component, then maybe it's best to leave it as a console application. This way you can write various informatative messages to the console window to aid you debugging and let you see what's going on.

But defintelely, when you complete the component, wrap it up in a windows service. (as the others say)

Avatar of dhodge

ASKER

Interesting, the thing I was trying to acheive with all this remoting stuff was an 'out of process exe'.  

Since there is no direct .Net equivalent I looked into Remoting because I didn't want the headache of maintaining a service.

Any more thoughts ?
Maintaining a service is very easy in .net - it shouldn't cause you too much of a headache.

Smg.
Avatar of dhodge

ASKER

Does anybody think there is any advantages to remoting (supported by a service form the server) over a service doing the whole thing?  Probably the entire installation of this component(s) will be local machine anyway.
if you have a service doing the whole thing, you still need a mechanism to communicate with it.. and that will probably be remoting (unless you write your own)

can you explain your configuration, and why you want to use an out of process .exe equivalent.

It may be that .net has a different method of achieving your final goal, and you may be barking up the wrong tree.
Avatar of dhodge

ASKER

We use a third party program that is mission critical (hate them words) it must store state at process level, we guess this because whenever we run it in IIS (on any isolation level) the whole system dies.  Unless we move it out of process.

The remoting has moved it out of process, but it comes with having to somehow keep the server running.

I believe the other option is a service, because this would also be out of process.
THe proper way to deal with this is to use NLB (Network Load Balancing). This feature comes with Windows 2000 Advanced and Datancenter Server, as well as with all (!) .NET server editions (also Web Server).

NLB enabled you to have several machines listen on the same IP address and ports simultaneously. Depending on configuration, you can have the incoming requests distributed randomly on the machines (best load distribution, but may rise issues with statefulness), or have every source IP talk to one specific machine (sort of sateful per IP address), or always use the same machine until it fails (stateful, fallback).

Your service then runs normally on several machines in parallel, and you don't have to care about the failover yourself - and you can even use the load balancing to enhance performance when several machines are answering requests at the same time.
Aren't you fully satisfied with the answer? You gave me a B grade, so there must be something you were not happy with - please let me know so that I can enhance the quality of my future answers.
Avatar of dhodge

ASKER

I guess an A grade would have been an example of what code I would have had to put into the service.
The same come you're using in the nnormal app... and since the code for the service is created automatically, I don't see what code you would have expected?