Solved

c# windows service

Posted on 2006-11-10
7
249 Views
Last Modified: 2010-04-16
Hi,

I've been looking at creating a windows service is c# for an engine I am writing.  The question I have is when it's implemented does the windows service run in it's own application domain.

I suppose the question is does the windows service code have a managed .net wrapper. Also whats the advantages of writing it as a windows service, compared to implementing it as c# class library.


Bob.
0
Comment
Question by:scope_creep
  • 4
  • 3
7 Comments
 
LVL 15

Expert Comment

by:ozymandias
ID: 17914327
Not sure what you mean about the application domain.

Writing a service in C# means simple extending System.ServiceProcess.ServiceBase and implementing the  methods :

protected override void OnStart(string[] args)
protected override void OnStop()
protected override void OnPause()
protected override void OnContinue()

I suppose you could implement it as a dll but you would still need an entry point and by default with service projects you get an exe.
0
 

Author Comment

by:scope_creep
ID: 17914372
Hi ozymandias

I'm not really to bother how its implemented, as long as its get done correctly. With a dll you don't get
get an exe as you need to instantiate the dll from an exe. Anyway, what i'm asking is can you do remoting to a windows service and send .net remote events.

Bob.


0
 

Author Comment

by:scope_creep
ID: 17914453
Hi ozymandias,

I've also thought, is it possibel for a windows service to have its own log file.

regards
Bob.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 15

Expert Comment

by:ozymandias
ID: 17914536
>> can you do remoting to a windows service and send .net remote events

Not sure  on this one, but I see no reason why not.

>> is it possibel for a windows service to have its own log file.
Yes, of course. It is just a normal windows program. As long as the account used to run the service has the correct priviledges the service can do anything.
It can certainly create and write to a log file or the event log.
I have done both with services in the past.
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 350 total points
ID: 17914635
>> can you do remoting to a windows service and send .net remote events

Looking at this again the answer is yes.
The service itself would probably be a server in the sense that it listens for the evnts on a cannel/port and then invokes event handling methods or classes when it receives a call.

There is an example of thsi here : http://msdn2.microsoft.com/en-US/library/6z5ezzh0.aspx.

The only difference being the the server.cs in the example would be written as a service.
0
 

Author Comment

by:scope_creep
ID: 17914643
Hi ozymandias,

I found some samples for it on codeproject. Its seems they can host .net remote objects, have their own log file, outside the event log for fine and coarse grain logging.

Only question I have remaining does it allow you to host web services, which I suspect it probably will.

regards
Bob.
0
 

Author Comment

by:scope_creep
ID: 17914662
Hi ozymandias,


Thats ideal. Bob.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

791 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