471,338 Members | 1,009 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Convert Console App To Windows Service


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?

Jul 21 '05 #1
3 6096
ja*****@texeme.com wrote:


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
Jul 21 '05 #2

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.
ja*****@texeme.com wrote:

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?

Jul 21 '05 #3

I found one answer that works.

But, I want to know more.

I am sending that email today!

peter wrote:
ja*****@texeme.com wrote:


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

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jack David | last post: by
3 posts views Thread by jabailo | last post: by
1 post views Thread by Lou Civitella | last post: by
4 posts views Thread by Peter | last post: by
reply views Thread by rosydwin | last post: by

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.