Convert Console App To Windows Service

J

jabailo

I am running the following remoting server as a Console application, and
I want to convert it to a Windows Service.


[STAThread]
static void Main(string[] args)
{
System.Runtime.Remoting.RemotingConfiguration.
Configure("ChatServer.exe.config");

Console.WriteLine("Chat Server Started. Press enter to exit");
Console.ReadLine();
}

As you can see, the Console.ReadLine() causes it to load and remain
running so it can listen for requests.

What should I do in my Windows service to keep the port open?

Should I just put it in the service constructor?
 
P

peter

What should I do in my Windows service to keep the port open?

Should I just put it in the service constructor?

Hi,

I have a document I produced at work that explains all this for you. If
you send an email to

p[no-dot]bradley@uwic[dot]ac[dot]uk

I'll send you a copy in a reply from work tomorrow morning.

The document was produced as guidance notes for developers doing .NET
remoting and is (I like to think) quite clear - at least my fellow
developers have had no problem with it.

You'll be surprised how little you have to do.

Cheers


Peter
 
J

jabailo

Ok.

I just put this into the OnStart method and it did the trick.

Now I have a remoting service that I can connect to across a network (
and, presumably, across the Internet ) that runs as a windows service.

Very, very cool. My intent is to use it to message XML updates across
distributed clients.
 
J

jabailo

I found one answer that works.

But, I want to know more.

I am sending that email today!
What should I do in my Windows service to keep the port open?

Should I just put it in the service constructor?

Hi,

I have a document I produced at work that explains all this for you. If
you send an email to

p[no-dot]bradley@uwic[dot]ac[dot]uk

I'll send you a copy in a reply from work tomorrow morning.

The document was produced as guidance notes for developers doing .NET
remoting and is (I like to think) quite clear - at least my fellow
developers have had no problem with it.

You'll be surprised how little you have to do.

Cheers


Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top