Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 814
Karthik Avatar asked Oct 18 '12 18:10

Karthik


People also ask

What is the difference between WCF service and WCF Service application?

The major difference is that the WCF Service Application has a . svc file, whereas the WCF Service Library does not have a . svc file. Suppose we want to host this service application in IIS, then you need to specify for IIS the execution runtime environment requirements.

What is difference between WebService and WCF?

Attributes − WCF service is defined by ServiceContract and OperationContract attributes, whereas a web service is defined by WebService and WebMethod attributes. Protocols − WCF supports a range of protocols, i.e., HTTP, Named Pipes, TCP, and MSMQ, whereas a web service only supports HTTP protocol.

What is the difference between WebService and Windows Service?

A Web Service is a dll hosted by a web server and run as a web application and can be spun up upon request. A windows service is an exe hosted by the operating system and runs continuously waiting on a request.

Is WCF SOAP or REST?

Normally, a WCF service will use SOAP, but if you build a REST service, clients will be accessing your service with a different architectural style (calls, serialization like JSON, etc.). Exposing a WCF service with both SOAP and REST endpoints, requires just a few updates to the codebase and configuration.


2 Answers

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

like image 167
IanBru Avatar answered Oct 02 '22 15:10

IanBru


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.

like image 34
Aaron Smith Avatar answered Oct 02 '22 14:10

Aaron Smith