PC Review


Reply
Thread Tools Rate Thread

Convert Console App To Windows Service

 
 
jabailo@texeme.com
Guest
Posts: n/a
 
      23rd Jun 2005

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?



 
Reply With Quote
 
 
 
 
peter
Guest
Posts: n/a
 
      23rd Jun 2005
(E-Mail Removed) 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
 
Reply With Quote
 
jabailo@texeme.com
Guest
Posts: n/a
 
      23rd Jun 2005

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.


(E-Mail Removed) 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?
>
>
>

 
Reply With Quote
 
jabailo@texeme.com
Guest
Posts: n/a
 
      23rd Jun 2005

I found one answer that works.

But, I want to know more.

I am sending that email today!

peter wrote:
> (E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows service with console =?Utf-8?B?Um9iIFdoaXRl?= Microsoft Dot NET Framework 3 12th May 2005 10:55 AM
Migrating Console App To Windows Service Jeremy S. Microsoft C# .NET 1 23rd Jan 2005 06:07 PM
Windows service Vs Console app performance Ollie Leahy Microsoft Dot NET Framework 8 25th Jun 2004 06:55 PM
Convert Console App To Windows Service Question Jack David Microsoft C# .NET 1 11th May 2004 07:54 PM
Architecture: Web Service as Management Console for Windows Service Vincent Mouton Microsoft Dot NET Framework 0 10th Nov 2003 11:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:06 PM.