?
Solved

c# windows service

Posted on 2006-11-10
7
Medium Priority
?
260 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 1400 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 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