473,390 Members | 1,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 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 6264
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris | last post by:
Hi, Currently, I have a console application written in C# and an unmanaged legacy DLL written in VC++ 6.0. In the DLL's previous application, when an event occurs in the DLL, a windows message...
1
by: Jack David | last post by:
How would I convert the following console app to a windows service?? using System; using System.IO; using FileProcessor;
1
by: Samuel R. Neff | last post by:
We're using a 3rd party C DLL in a project that we don't have source for. When we call the DLL from a console app everything works fine. However, when we call it from a Windows Service, the DLL...
3
by: jabailo | last post by:
I am running the following remoting server as a Console application, and I want to convert it to a Windows Service. static void Main(string args) {...
3
by: JohnH | last post by:
Does any one now how to create a .net service thet when run from the command line with say a -D argument will run as a console app and be able to output to that console window. The same .exe would...
1
by: Lou Civitella | last post by:
I have found code that Recycles the Application Pool but it was written in VBScript can anyone convert this for me to VB.Net? Thanks! 'Appendix B: Application Pool Recycle script - Save as...
12
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow...
0
by: sus124 | last post by:
Hello, I have a console application that I built for a filesystemwatcher in C#. I have to now convert it to a windows service. Since Express edition doesn't have an inbuilt template for windows...
4
by: Peter | last post by:
Does anyone know how to convert the following VB6 code to C# code? Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, Source As Any, ByVal bytes As Long) Dim...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.