Back to Questions

In WCF, what is the use of svc file. How to deploy this in IIS?

Your Answer

  • 12/16/2012 10:56:34 PM
  • Biju
  • 1

In WCF, what is the use of svc file. How to deploy this in IIS?

Generally .svc file is used to allow IIS hosting WCF service. It is just a declaration of the service type and service host factory type. Factory will create service host and it will in turn host the service. Service  is accessible by URL from virtual directory structure + .svc file. That was true in .NET 3.x.

In .NET 4.0 you don't need .svc file in two cases:
 

1 - You are using ServiceRoute class to configure routing for your service.http://msdn.microsoft.com/en-us/library/ee358760.aspx
2 - You are using Configuration based activation. http://msdn.microsoft.com/en-us/library/dd807499.aspx

Mark Up of a SVC file :

<%@ ServiceHost Language="C#" Debug="true" Service="WcfService1.Service1" CodeBehind="Service1.svc.cs" %>

  • 12/17/2012 10:25:04 AM
  • test

Back to Questions