Karthik
Karthik

Reputation: 2399

WCF Service vs Window service

Am a newbie to WCF.I have a scenario where i need to create a application that runs 24x7 picks up mail from a mailbox and create few reports.I did it using winform and it worked.but i got a problem that the server on which the application was hosted has a auto log off policy which closes my application when server is inactive for a certain period of time.I thought i could implement it as a window service.Is WCF service recommended for this Scenario,any advantage of using it.I thought of WCF service since it will be learning curve for me.Please advice.

Update: its application that works based on a timer.It pings a particular mailbox every 5 minutes to see for new mail.If a new mail is found it downloads an excel creates PDF report and mails it back to some email ids.

DLLS used : OpenPOP and Itextsharp.

Upvotes: 19

Views: 19409

Answers (3)

IanBru
IanBru

Reputation: 860

A windows service is what you need.

WCF is a communications library, and unless you plan to communicate with your application via a client, you don't need it.

Your problem is related to activation, and keeping your code active in the background is what windows services do.

It's not difficult, this will help you get started.

http://www.codeproject.com/Articles/14353/Creating-a-Basic-Windows-Service-in-C

Upvotes: 26

Aaron Smith
Aaron Smith

Reputation: 3362

WCF is only useful if you're running a webservice. Just a normal windows service should satisfy your needs here. As long as the machine is up the service should keep running.

Upvotes: 3

Jed
Jed

Reputation: 10887

If your application does what you want and works fine up until the server is in active, then you should consider solving the problem by setting up the server to not go into an inactive state.

In other words, since a server itself should never go into a standby (inactive) mode, my guess is that the policy that you speak of is only implemented for inactive human users - the policy probably (and shouldn't) affect the system level users.

So, if you were to run your application as a System user (or a Network user), the problem should go away.

Based on your explanation, WCF is not the right solution to your problem for two reasons:

  1. WCF is useful for when you have another application (client) that consumes the WCF service) - It doesn't sound like you are in need of a client/server service in your app
  2. If you were to run the WCF service as the same user as your current application is running under, your problem would still exist (i.e. the WCF service will be inactive eventually due to the policy).

Upvotes: 0

Related Questions