简体   繁体   中英

Is this a WCF Service?

My question is regarding WCF services. I've recently been involved in an ASP.NET project working with WCF Services (I haven't had much exposure to them before) and I'm getting confused with what is a WCF service and what isn't.

My confusion comes from a WCF service we are using which doesn't appear to be a typical WCF service. When I create a WCF service by adding a new project in Visual Studio (using the 'WCF Service Application' template) it produces a project with a Service.svc and the projects icon is of the web service icon. However, for another WCF service we have (for use with calls from Ajax to the ASP.NET application) we have a project which appears to be a normal C# project - its icon is the typical C# project icon and the project contents only consists of a Service.cs file (not the normal .svc extension) which calls other functions. This Service.cs file implements the ServiceContract/ServiceBehavior/OperationContract attributes however so maybe this is a WCF service which has been manually created?

In the main projects Web.config there is a tag which points to the Service.cs file, whereas the a 'real' WCF Service created with the WCF template does not include this tag.

Hopefully I have included enough information for someone to tell me if the project of concern is actually a WCF service?

Many thanks in advance!

WCF Stands for Windows Communication foundation. WCF is a Combination of Web Services+MSMQ+ .NET Remoting +COM +. if you compare WCF with Web services the limitation of webservice is web service support only HTTP protocol.2] you can not host webservices on two diffrent protocol.3] webservice does not provide security,Concurrency control etc.

now coming on wcf.. you can create wcf service with wcf template and other is class library Project.. if you use class library then you can host it by several ways like Self Hosting,Host On IIS ie .svc file, but if you use WCF template which contain .SVC file as you mentioned in question you can only host that project/service on IIS....

A WCF service can be self hosted and be created without actually using the Visual Studio project template. All you need to do is a properly attributed interface, a class that implements that interface and code in your project that instantiates a ServiceHost . Most people would put the service configuration in the app.config file, but some also prefer to configure the service in code.

The WCF project template simply includes stuff so you can easily host the service in ISS or Windows Activation Service (WAS).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM