Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between using a .svc file and hosting the WCF service in 'WCF Service Host'?

Tags:

c#

asp.net

wcf

Ive written a service and it has a .svc file. I can browse to this service but this seems to be a strange way of doing it. Im wondering whether is okay to produce a service using a .svc file or should we be looking at using the WCF Service Host and setting up the bindings etc....

like image 471
Exitos Avatar asked Jun 09 '11 13:06

Exitos


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 .SVC file?

A . svc file contains a WCF-specific processing directive (@ServiceHost) that allows the WCF hosting infrastructure to activate hosted services in response to incoming messages. The most common syntax for a . svc file is in the following statement.

What are the differences between WCF and ASMX Web services?

5) The purpose of ASMX services is to send and receive data using SOAP over HTTP protocol. However, WCF services can send and receive data using any format over different protocols like HTTP, HTTPS, TCP, MSMQ etc.


2 Answers

An svc file is for when you're hosting within IIS (it can now host without these in .NET 4.0). Unless you have a reason to self host I'd strongly recommend sticking with IIS (WAS) as it provides so much of the hosting infrastructure for "free".

UPDATE (11/16): Updated broken link to point to a comparative ASP.NET forums post. Previous link was here in case it comes back to life sometime in the future.

like image 77
Darren Lewis Avatar answered Nov 12 '22 18:11

Darren Lewis


Well, In WCF you are not restricted to hosting in just IIS. The .svc file is equivalent to an asmx file. If you are going to host in IIS, I have used the .svc file, but if I am hosting in a console app or windows service, I instantiate the service through ServiceHost.

like image 34
Xaisoft Avatar answered Nov 12 '22 19:11

Xaisoft