Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I've been search and reading on this topic for a few days now but can't really find a simple answer to my question. Which of course means there probably isn't one, but hey, here's to hoping!

I would just like to know the advantages/disadvantages and differences of hosting a WCF service in an Asp.Net Web Application or a Windows Service

In my solution I have both a windows service and a Web App, and I'm just trying to get them to talk to eachother.
Posted

1 solution

Hello,

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.
An endpoint can be a client of a service that requests data from a service endpoint. The messages can be as simple as a single character or word sent as XML, or as complex as a stream of binary data.

Windows Service: Technical implementation of a program which
is intended to run in the background continuously. Example: SQL Server Service and all other services that you would see under Services.msc console on windows xp or vista.

When should I go to create Window service ?
You would use this when you want to create windows service. The sevice which has to run in the background without UI. Has basically got nothing to do with WCF. It can be a genenral ftp service or http service, MSMQ service.
Goto Start-> Run and type Services.msc. You will see services that the OS and other software installs and runs there.

When should I go to create a new WCF service application?
Like you can host your WCF services in windows service, where the services are constantly listening at some port. You can on the same lines host the services in IIS. For this you actually use this Option. Open this template and give it a run- F5. You will see the service by default will use ASP.net development server (see your windows tray) and host this service for you.

In what scenarios must WCF be used:

1) A secure service to process business transactions.
2) A service that supplies current data to others, such as a traffic report or other monitoring service.
3) A chat service that allows two people to communicate or exchange data in real time.
4) A dashboard application that polls one or more services for data and presents it in a logical presentation.
5) Exposing a workflow implemented using Windows Workflow Foundation as a WCF service.
6) A Silverlight application to poll a service for the latest data feeds.

For more information please go through following links:
What's the Difference between WCF and Web Services?[^]
Difference Between WCF and Windows Service[^]
 
Share this answer
 
v2
Comments
bjorandb 11-Jul-12 9:58am    
Yes this did help give me some clairty on how WCF works. However, I'm still confused on how exactly I can use this to fit my needs. I apologize to begin with because I am a novice developer and even less experience with WCF. Let me first describe what I am trying to do, and maybe you could simplify it for me.


I have a Asp.Net web application running on a server. I then also have a Windows Service running on a different server. The windows service is a simple text file searcher. When the user enters a term on the Web site I want to hand the search term over to the windows service so it can search a text file for the term that was entered by the user.

I think WCF is the best method to do this?

Could I right click on my Web App, go to Add -> WCF Service (then host it via IIS) and make an end point in my Windows Service?


Thank you in advance for any help you're able to give me, I've been stuck on this for days!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900