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.
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.
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With