?
Solved

Remoting

Posted on 2003-03-27
13
Medium Priority
?
402 Views
Last Modified: 2010-04-15
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?
0
Comment
Question by:dhodge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 4
  • +1
13 Comments
 
LVL 14

Accepted Solution

by:
AvonWyss earned 750 total points
ID: 8223572
Why aren't you putting the server part into a windows service if you want it running all the time? Or, if it hat to be a forms application, you can lso just set up, store the reference in a static field, and forget the service...

Do this in the very first lines of Main() - therefore making sure that it stays running...
0
 
LVL 3

Expert Comment

by:Sijin
ID: 8223787
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.
0
 
LVL 10

Expert Comment

by:smegghead
ID: 8223847
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)

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Author Comment

by:dhodge
ID: 8226621
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 ?
0
 
LVL 10

Expert Comment

by:smegghead
ID: 8226677
Maintaining a service is very easy in .net - it shouldn't cause you too much of a headache.

Smg.
0
 
LVL 2

Author Comment

by:dhodge
ID: 8226770
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.
0
 
LVL 10

Expert Comment

by:smegghead
ID: 8226900
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)

0
 
LVL 10

Expert Comment

by:smegghead
ID: 8226907
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.
0
 
LVL 2

Author Comment

by:dhodge
ID: 8226948
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.
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 8227049
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.
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 8264977
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.
0
 
LVL 2

Author Comment

by:dhodge
ID: 8265270
I guess an A grade would have been an example of what code I would have had to put into the service.
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 8267748
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?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question