Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF service. Where to add . svc file

Tags:

wcf

I have created a new "WCF service library" type project. I have created a file for my contract and one file which implements the interface. Both files have the .cs extension.

Please can anyone tell me how can I consume it. I mean where should I add my .svc file

like image 848
Amit Avatar asked Aug 25 '10 13:08

Amit


People also ask

What is SVC file in WCF?

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. This file contains the details required for WCF service to run it successfully.


1 Answers

You have to create another project - Web application or WCF Service application (generally it is the same as Web application with some added references). Then you have to reference your service library in the new project and add .svc file. Delete code behind file from newly created .svc file and open markup of that file. Modify Service attribute of @ServiceHost directive. The attribute has to point to your service implemented in library (full name with namespace). Then add configuration to web config.

If you use WCF 4.0 you don't have to create configuration (default will be used) and you even don't need to define .svc file. WCF 4.0 supports configuration based activation.

like image 66
Ladislav Mrnka Avatar answered Sep 22 '22 06:09

Ladislav Mrnka