Posts Tagged ‘.NET 4.0’

Every WCF service needs to have a host process.It can be a windows service,IIS or any other .NET program.This host process will create an instance of the System.ServiceModel.ServiceHost class or any custom class deriving from System.ServiceModel.ServiceHostBase.This host class will manage the service configurations, behaviors, channels and make it accessible to the outside world.When a service is hosted in IIS it behaves a little bit differently.Here we need to create a physical file with .svc extension in the virtual directory of the web server.This file actually points to the service class implementing the ServiceContract and System.ServiceModel.Activation.ServiceHostFactory or a derived class System.ServiceModel.Activation.ServiceHostFactoryBase.When IIS receives a request with that .svc file in URI the corresponding ServiceHostFactory creates an instance of the ServiceHost.The markup contained in a .svc file is shown below: